Thread overview
[Issue 3613] New: enforce cannot be called with template parameters and compile.
Dec 13, 2009
Rob Jacques
Oct 08, 2010
Shin Fujishiro
Oct 22, 2012
Andrej Mitrovic
December 13, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3613

           Summary: enforce cannot be called with template parameters and
                    compile.
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: sandford@jhu.edu


--- Comment #0 from Rob Jacques <sandford@jhu.edu> 2009-12-12 22:00:37 PST ---
The following test case:

enforce!(bool,"hi",5)(true, "hi");

results in an error:

Error: template instance enforce!(bool,"hi",5) matches more than one template
declaration, enforce(T,string file = __FILE__,int line = __LINE__) and
enforce(T,string file = __FILE__,int line = __LINE__)

using DMD 2.037.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 08, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3613


Shin Fujishiro <rsinfu@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |rsinfu@gmail.com


--- Comment #1 from Shin Fujishiro <rsinfu@gmail.com> 2010-10-08 01:36:38 PDT ---
The problem seems to be surprisingly deep... Here're reduced test cases.

This code compiles fine:
--------------------
void main()
{
    test!int(-1, 10);
    test!int(-1, "");
}
void test(T)(T v, int) {}
void test(T)(T v, string) {}
--------------------

While the following doesn't:
--------------------
void main()
{
    test!int(-1, [10]); // (4)
    test!int(-1, "");
}
void test(T)(T v, int[]) {} // (6) just changed from int -> int[]
void test(T)(T v, string) {} // (7)
--------------------
% dmd -o- -c test.d
test.d(4): Error: template test.test(T) test(T) matches more than one template
declaration, test.d(6):test(T) and test.d(7):test(T)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3613


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich@gmail.com
         Resolution|                            |FIXED


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-21 19:29:32 PDT ---
Both comments' samples work now.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------