[Issue 13617] New: alias with scopes
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Oct 14 14:00:16 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13617
Issue ID: 13617
Summary: alias with scopes
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: jens.k.mueller at gmx.de
I find the behavior of the following code unexpected.
bool foo(alias f)()
{
return is(typeof(f) == int);
}
unittest
{
{
int a;
static assert(foo!a);
}
{
float a;
static assert(foo!a); // passes unexpectedly
}
}
The second assert passes unexpectedly. If you change the variable name to b it
fails as expected. Bug or not so unexpected behavior? To me it's a bug. But
maybe there is a explanation that I'm not aware of.
The same behavior is observed when foo is defined as a template.
This is dmd v2.066.0 on Linux.
--
More information about the Digitalmars-d-bugs
mailing list