www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11878] New: UFCS for base-2 literals too

https://d.puremagic.com/issues/show_bug.cgi?id=11878

           Summary: UFCS for base-2 literals too
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2014-01-07 15:56:50 PST ---
void foo(int x) {}
void main() {
    33.foo; // OK
    0b100001.foo; // Error
    0x21.foo; // Error
}


DMD 2.065alpha gives a colorful group of error messages:


test.d(4): Error: found 'b100001' when expecting ';' following statement
test.d(5): Error: exponent required for hex float
test.d(5): Error: found 'oo' when expecting ';' following statement
test.d(5): Warning: use '{ }' for an empty statement, not a ';'


I think the "0b100001.foo;" case could be accepted.


Note that currently the situation with float literals is OK:

import std.stdio;
void f(float x) {
    writeln(x);
}
void main() {
    33.f; // calls f.
    float x = 33.0f; // float literal.
}


So perhaps this is also a bug report for hex float literals.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 07 2014