www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15063] New: Template Instantiation Accepts Invalid Code

https://issues.dlang.org/show_bug.cgi?id=15063

          Issue ID: 15063
           Summary: Template Instantiation Accepts Invalid Code
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: jack jackstouffer.com

The following code should not compile, as the call to test1 matches both
overloads.


import std.typecons : Flag;

void test1(alias pred="a == b", T)(T a) {}

alias SomeFlag = Flag!"SomeFlag";
void test1(SomeFlag allocate_gc = SomeFlag.no, T)(T a) {}

void main()
{
    test1(1);
}

--
Sep 15 2015