[Issue 2303] New: static assert in a template function is not reported
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Fri Aug 22 00:53:18 PDT 2008
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=2303
           Summary: static assert in a template function is not reported
           Product: D
           Version: 2.018
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: samukha at voliacable.com
I wasn't able to reduce this further. Must be related to 2227
T foo(T : S!(U), U)(invariant(U) u)
{
    T s;
    bar!(T)(s, u);
    return s;
}
void bar(T : S!(U), U)(T s, invariant(U) u)
{
    static assert(false, "Error!"); // compiles if this line is commented out
}
void main()
{
    foo!(S!(int))(1);
}
----
: template Test.bar(T) does not match any function template declaration
: template Test.bar(T) cannot deduce template function from argument types
!(S!(int))(S!(int),invariant(int))
: template instance Test.foo!(S!(int),int) error instantiating
This should report the static assert message, preferably with template
instantiation trace.
-- 
    
    
More information about the Digitalmars-d-bugs
mailing list