www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1677] New: Segfault on specialization on template with one non-tuple and one tuple parameter

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1677

           Summary: Segfault on specialization on template with one non-
                    tuple and one tuple parameter
           Product: D
           Version: 1.023
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: jarrett.billingsley gmail.com


struct Temp(T, U...)
{

}

void foo(T : Temp!(U, V), U, V)(T t)
{

}

void main()
{
        Temp!(float, float, char) y;
        foo!(typeof(y))(y);
}

Interesting things:

- Using "Temp!(float, float) y" instead works.
- Using a specialization with three inferred parameters instead of two ("T :
Temp!(U, V, W), U, V, W") works.
- Using a specialization with one inferred parameter causes a compilation
error.
- Changing the template Temp to take only a tuple parameter (remove T) causes
compilation errors.

I don't know whether to flag this as 'ice-on-invalid-code' or
'ice-on-valid-code' because I don't even know if this code is valid.


-- 
Nov 17 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1677


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
             Status|NEW                         |RESOLVED
           Keywords|                            |ice-on-invalid-code
         Resolution|                            |WORKSFORME





Of course it's invalid.  Temp!(float, float, char) (three arguments) doesn't
match Temp!(U, V) (two arguments).

But under DMD 1.033 and 1.035, it reports an error as expected.

bz1677.d(14): template instance foo!(Temp!(float,float,char)) does not match
any  template declaration
bz1677.d(14): Error: template instance 'foo!(Temp!(float,float,char))' is not a
variable
bz1677.d(14): Error: function expected before (), not
foo!(Temp!(float,float,char)) of type int


-- 
Sep 09 2008