www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7132] New: [tdpl] Exponential operator ^^ for integrals does not compile without any import

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7132

           Summary: [tdpl] Exponential operator ^^ for integrals does not
                    compile without any import
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrei metalanguage.com



18:13:15 PST ---
//import std.stdio;

void main() {
    uint base;
    uint exp;
    static assert(is(typeof(base ^^ exp) == uint));
}

test.d(8): Error: static assert  (is(typeof(__error) == uint)) is false

If the import is uncommented, the code compiles.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 18 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7132


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au



That's because ^^ requires import std.math;
To make it work without the import, we need to move the intpow function out of
std.math, and into the runtime.

That's quite reasonable, provided we don't have to do the same for floating
point powers.
(To implement floating point powers, most of std.math would need to move to the
runtime. In fact to do it with correct rounding, parts of bigint would be
required as well).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 24 2011