D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 11878 - UFCS for base-2 literals too
Summary: UFCS for base-2 literals too
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-07 15:56 UTC by bearophile_hugs
Modified: 2020-03-21 03:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2014-01-07 15:56:50 UTC
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.
Comment 1 basile-z 2020-02-20 10:04:24 UTC
It works on base2 literals.
It work on hex but the problem here was that f is an hex digit...

void zoo(int x) {}
void main() {
    33.zoo; // OK
    0b100001.zoo; // OK
    0x21.zoo; // OK
}