www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3613] New: enforce cannot be called with template parameters and compile.

reply d-bugmail puremagic.com writes:
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: -------
Dec 12 2009
parent d-bugmail puremagic.com writes:
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: -------
Oct 08 2010