Bug 15557 – Common type of void* and const(int)* should be const(void)*, not const(int)*

Status
REOPENED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-01-12T02:34:04Z
Last change time
2024-12-13T18:46:30Z
Assigned to
No Owner
Creator
Jakob Ovrum
Moved to GitHub: dmd#19088 →

Comments

Comment #0 by jakobovrum — 2016-01-12T02:34:04Z
--- void main() { const(int)* a; void* b; auto c = true ? a : b; pragma(msg, typeof(c)); // const(int)* } --- typeof(c) should be const(void)*. This affects std.traits.CommonType.
Comment #1 by razvan.nitu1305 — 2022-10-28T09:19:06Z
This has now been fixed. It seems indeed that the common type is void*, however the initial example fails at line 5: test.d(5): Error: cannot implicitly convert expression `a` of type `const(int)*` to `void*`, which is correct.
Comment #2 by ag0aep6g — 2022-10-29T06:00:51Z
(In reply to RazvanN from comment #1) > This has now been fixed. It seems indeed that the common type is void*, > however the initial example fails at line 5: test.d(5): Error: cannot > implicitly convert expression `a` of type `const(int)*` to `void*`, which is > correct. This has not been fixed. The common type is `const(void)*`, not `void*`. Reopening.
Comment #3 by apz28 — 2022-10-29T13:26:46Z
Try different order & type -> still problem void main() { const(int)* a; const(void)* b; auto c = true ? b : a; pragma(msg, typeof(c)); } onlineapp.d(5): Error: cannot implicitly convert expression `b` of type `const(void)*` to `const(int)*` const(int)*
Comment #4 by robert.schadek — 2024-12-13T18:46:30Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19088 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB