[Issue 2167] incorrect behaviour of IsExpression on invalid template instance
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 24 05:15:10 PST 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2167
smjg at iname.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg at iname.com
Keywords| |rejects-valid
Summary|incorrect static assert |incorrect behaviour of
|behavior |IsExpression on invalid
| |template instance
------- Comment #5 from smjg at iname.com 2008-11-24 07:15 -------
The original issue isn't a bug, since the point of IsExpression is that
semantic errors never escape it - it just evaluates to false instead.
But the issue raised from comment 2 onwards is certainly a bug, and the
behaviour is quite strange.
----------
import std.stdio;
class Templ(T) { this(){ unknown_identifier; } }
void main() {
pragma(msg, "In main: " ~ is(Templ!(int)).stringof);
}
----------
In main: 0
----------
But add this line at the very end
pragma(msg, "Global: " ~ is(Templ!(int)).stringof);
----------
Global: 1
In main: 1
bz2167a.d(2): Error: undefined identifier unknown_identifier
bz2167a.d(2): Error: identifier has no effect in expression
(unknown_identifier)
----------
--
More information about the Digitalmars-d-bugs
mailing list