Bug 8174 – short floating point literals not catched in the parser
Status
RESOLVED
Resolution
WORKSFORME
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-05-31T08:30:00Z
Last change time
2013-11-09T08:30:49Z
Keywords
diagnostic
Assigned to
nobody
Creator
hoganmeier
Comments
Comment #0 by hoganmeier — 2012-05-31T08:30:02Z
void main()
{
float f = 1.f;
}
$ dmd test.d
test.d(3): Error: undefined identifier 'f'
This should be catched in the parser with a proper error message.
Comment #1 by alex — 2012-05-31T08:31:17Z
No? This is UFCS at work. It's trying to apply a function f to the integer literal 1.
Comment #2 by hoganmeier — 2012-05-31T08:34:21Z
Ah didn't think of UFCS!
The error message could still be more helpful I guess.
Comment #3 by issues.dlang — 2012-05-31T08:47:31Z
But what else would it be? It's complaining about exactly what you're doing - using an undefined indentifier. It even tells you exactly what the undefined identifier is.
Comment #4 by hoganmeier — 2012-05-31T09:05:32Z
Don't know. Maybe it could mention it's trying UFC. Whatever.
Comment #5 by yebblies — 2013-11-09T08:29:05Z
Now prints
testx.d(4): Error: no property 'f' for type 'int'
so I guess we're done.