Bug 11878 – UFCS for base-2 literals too

Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-01-07T15:56:50Z
Last change time
2020-03-21T03:56:34Z
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-01-07T15:56:50Z
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 by b2.temp — 2020-02-20T10:04:24Z
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 }