[Issue 13281] New: Print type suffix of real/complex literals in pragma(msg) and error diagnostic
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Aug 11 01:37:37 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13281
Issue ID: 13281
Summary: Print type suffix of real/complex literals in
pragma(msg) and error diagnostic
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: diagnostic
Severity: enhancement
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: k.hara.pg at gmail.com
Compiler prints type suffix of integer literals in pramga(msg) and error
diagnostic.
pragma(msg, 123); // print 123
pragma(msg, 123u); // print 123u
pragma(msg, 123L); // print 123L
pragma(msg, 123uL); // print 123LU
// Error: cannot implicitly convert expression ...
string x1 = 123; // ... (123) of type int to string
string x2 = 123u; // ... (123u) of type uint to string
string x3 = 123L; // ... (123L) of type long to string
string x4 = 123uL; // ... (123LU) of type ulong to string
But, it doesn't for real/complex values.
pragma(msg, 123.4f); // print 123.4
pragma(msg, 123.4); // print 123.4
pragma(msg, 123.4L); // print 123.4
pragma(msg, 123.4fi); // print 123.4i
pragma(msg, 123.4i); // print 123.4i
pragma(msg, 123.4Li); // print 123.4i
pragma(msg, 123.4f+5.6fi); // print (123.4+5.6i)
pragma(msg, 123.4 +5.6i); // print (123.4+5.6i)
pragma(msg, 123.4L+5.6Li); // print (123.4+5.6i)
// Error: cannot implicitly convert expression ...
int x1 = 123.4f; // ... (123.4) of type float to int
int x2 = 123.4; // ... (123.4) of type double to int
int x3 = 123.4L; // ... (123.4) of type real to int
int x4 = 123.4fi; // ... (123.4i) of type ifloat to int
int x5 = 123.4i; // ... (123.4i) of type idouble to int
int x6 = 123.4Li; // ... (123.4i) of type ireal to int
int x7 = 123.4f+5.6fi; // ... ((123.4+5.6i)) of type cfloat to int
int x8 = 123.4 +5.6i; // ... ((123.4+5.6i)) of type cdouble to int
int x9 = 123.4L+5.6Li; // ... ((123.4+5.6i)) of type creal to int
I think compiler should print type suffix in all cases, because of consistency.
--
More information about the Digitalmars-d-bugs
mailing list