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



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
next sibling 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



---
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
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Oct 21 2012