Bug 11601 – pragma(msg, ...) output not silenced inside is(typeof()) and __traits(compiles, ...)

Status
REOPENED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-25T00:43:57Z
Last change time
2024-12-13T18:14:19Z
Assigned to
No Owner
Creator
Simen Kjaeraas
Moved to GitHub: dmd#17628 →

Comments

Comment #0 by simen.kjaras — 2013-11-25T00:43:57Z
void foo(T)() { static if (!is(T : int)) { pragma(msg, "Error message."); } static assert(is(T : int)); } void main() { assert(!is(typeof(foo!string))); } The above program outputs "Error message." before concluding that the function could not be instantiated. In my use case, the pragma is used to tell the user exactly what he's doing wrong, and have absolutely no use when testing if the code compiles or not.
Comment #1 by simen.kjaras — 2018-02-19T07:30:39Z
Works in 2.078.3.
Comment #2 by simen.kjaras — 2018-03-02T07:24:52Z
I was apparently a bit hasty in closing this. Encountered the same issue again today, and testing the code in comment #0 again shows that its behavior has not been fixed in 2.078.3.
Comment #3 by robert.schadek — 2024-12-13T18:14:19Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17628 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB