[Issue 1511] New: static assert doesn't fail as expected
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Sep 17 20:04:18 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1511
Summary: static assert doesn't fail as expected
Product: D
Version: 1.014
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: davidl at 126.com
import std.stdio;
template k(T)
{
static char[] conceptcheck1(){
T a, b;
static assert(is(typeof(a+b)));
return "";
}
void func(T t)
in
{
static assert(conceptcheck1()=="");
}
body
{
writefln(t);
}
void func1(T t)
in
{
static assert(conceptcheck1()=="");
}
body
{
writefln(t);
}
}
void main()
{
mixin k!(char[]); // this instantiation should make the conceptcheck1
fail
// mixin k!(float);
func("");
// mixin k!(float);
// mixin k!(char[]);
}
--
More information about the Digitalmars-d-bugs
mailing list