Bug 19499 – __c_long_double has exact match with double

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2018-12-18T15:59:41Z
Last change time
2018-12-28T17:01:13Z
Keywords
industry, rejects-valid
Assigned to
No Owner
Creator
Илья Ярошенко
See also
https://issues.dlang.org/show_bug.cgi?id=19201

Comments

Comment #0 by ilyayaroshenko — 2018-12-18T15:59:41Z
// Mircrosoft C Runtime import core.stdc.config; enum A(T : double) = true; enum A(T : __c_long_double) = false; pragma(msg, A!double); // Error in 2.083, compiles in 2.082 The pattern is used in Mir for integration with Python.
Comment #1 by bugzilla — 2018-12-21T08:01:37Z
The error message is: Error: undefined identifier __c_long_double, did you mean alias c_long_double? In general, avoid using names prefixed by __, as they are reserved for the compiler. Change it to c_long_double, and it will compile.
Comment #2 by ilyayaroshenko — 2018-12-21T08:16:37Z
(In reply to Walter Bright from comment #1) > The error message is: > > Error: undefined identifier __c_long_double, did you mean alias > c_long_double? > > In general, avoid using names prefixed by __, as they are reserved for the > compiler. Change it to c_long_double, and it will compile. No, as was mentioned in the issue it is for Microsoft runtime and looks like you compile the code with DigitalMars runtime. https://github.com/dlang/druntime/blob/master/src/core/stdc/config.d#L156 ---- version (CRuntime_Microsoft) { enum __c_long_double : double; alias __c_long_double c_long_double; } else version (DigitalMars) ----- as you can see it does not matter what to use in the issue: __c_long_double or c_long_double. __c_long_double was used because it appears in the compiler error msg.
Comment #3 by bugzilla — 2018-12-21T11:05:27Z
ok
Comment #4 by bugzilla — 2018-12-21T23:44:29Z
A self-contained test case: enum __c_long_double : double; enum A(T : double) = true; enum A(T : __c_long_double) = false; pragma(msg, A!double); test.d(6): Error: template test.A matches more than one template declaration: test.d(4): A(T : double) and test.d(5): A(T : __c_long_double) test.d(6): while evaluating pragma(msg, A!double)
Comment #5 by bugzilla — 2018-12-22T08:04:17Z
This was caused by: https://github.com/dlang/dmd/pull/8632 Specifically, the lines in mtype.d: if (tob) return implicitConvTo(tob);
Comment #6 by bugzilla — 2018-12-22T08:26:16Z
Comment #7 by github-bugzilla — 2018-12-28T17:01:13Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/e265d0c5dfc669cea1755c117d0d94e59b962077 fix Issue 19499 - __c_long_double has exact match with double https://github.com/dlang/dmd/commit/7581ed9d6f265f7bcd748656c3c7abb856500826 Merge pull request #9117 from WalterBright/fix19499 fix Issue 19499 - __c_long_double has exact match with double merged-on-behalf-of: Iain Buclaw <[email protected]>