[Bug c++/40808] [4.4/4.5 regression] member template specialization causes ICE

2009-10-23 Thread dodji at gcc dot gnu dot org


--- Comment #2 from dodji at gcc dot gnu dot org  2009-10-23 10:58 ---
I am not sure the example is invalid.

The Dummy()(Gen()) call expression obviously selects the operator template
typename F typename F::template Sig::ResultType operator()(F const f)
const in Dummy.

I believe the critical question is the following:

In:

~=~
template typename R struct CFunType { 
  template class Dummy1=Void, class Dummy2=Void
  struct Sig: public FunTypeWrongNumberOfSigArgs
  {
  };//#1

  template class Dummy
  struct SigVoid,Dummy : public FunTypeR
  {
  };//#2
};
~=~

Which Sig template is instantiated by typename F::template Sig ? Is it //#1
or //#2 ?

I think Sig matches the template #1 (as in Sigvoid,void) which is the
primary template. But then, the best specialization of #1 is selected by the
compiler. The arguments of that specialization are deduced from the arguments
of the primary template. The void,void argument list used to match the
primary template #1 is compatible with the parameters of the specialization #2.
So in the end it's #2 that is going to be instantiated.

The relevant parts of the C++ spec are, I believe, the following:

[temp.class.spec]
7. Partial specialization declarations themselves are not found by name
lookup. Rather, when the primary template name is used, any previously-declared
partial specializations of the primary template are also considered.

[temp.class.spec.match]
1. When a class template is used in a context that requires an instantiation
of the class, it is necessary to determine whether the instantiation is to be
generated using the primary template or one of the partial specializations.
This is done by matching the template arguments of the class template
specialization with the template argument lists of the partial
specializations.

That being said, the crash seems to happens later during the mangling of the
operator template typename F typename F::template Sig::ResultType
operator()(F const f) const, precisely on the Sig template-id because the
mangling code doesn't expect the template argument list to be empty.


-- 

dodji at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |dodji at gcc dot gnu dot org
   |dot org |
 Status|NEW |ASSIGNED
   Last reconfirmed|2009-08-25 14:16:58 |2009-10-23 10:58:13
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40808



Re: [Bug c++/40808] [4.4/4.5 regression] member template specialization causes ICE

2009-10-23 Thread Dodji Seketeli
Posted a patch at http://gcc.gnu.org/ml/gcc-patches/2009-10/msg01469.html

-- 
Dodji Seketeli
Red Hat


[Bug c++/40808] [4.4/4.5 regression] member template specialization causes ICE

2009-10-23 Thread dodji at gcc dot gnu dot org


--- Comment #3 from dodji at gcc dot gnu dot org  2009-10-23 21:32 ---
Subject: Bug 40808

Author: dodji
Date: Fri Oct 23 21:32:35 2009
New Revision: 153516

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=153516
Log:
Fix for PR c++/40808

gcc/cp/ChangeLog:

PR c++/40808
* mangle.c (write_template_args): Allow mangling of empty template
argument list. Updated function comments.

gcc/testsuite/ChangeLog:

PR c++/40808
* g++.dg/abi/mangle33.C: New test

Added:
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/abi/mangle34.C
Modified:
branches/gcc-4_4-branch/gcc/cp/ChangeLog
branches/gcc-4_4-branch/gcc/cp/mangle.c
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40808



[Bug c++/40808] [4.4/4.5 regression] member template specialization causes ICE

2009-10-23 Thread dodji at gcc dot gnu dot org


--- Comment #4 from dodji at gcc dot gnu dot org  2009-10-23 21:39 ---
Subject: Bug 40808

Author: dodji
Date: Fri Oct 23 21:38:50 2009
New Revision: 153517

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=153517
Log:
Fix for PR c++/40808

gcc/cp/ChangeLog:

PR c++/40808
* mangle.c (write_template_args): Allow mangling of empty template
argument list. Updated function comments.

gcc/testsuite/ChangeLog:

PR c++/40808
* g++.dg/abi/mangle34.C: New test

Added:
trunk/gcc/testsuite/g++.dg/abi/mangle34.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/mangle.c
trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40808



[Bug c++/40808] [4.4/4.5 regression] member template specialization causes ICE

2009-10-23 Thread dodji at gcc dot gnu dot org


--- Comment #5 from dodji at gcc dot gnu dot org  2009-10-23 21:42 ---
Fixed in 4.4 and 4.5


-- 

dodji at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40808



[Bug c++/40808] [4.4/4.5 regression] member template specialization causes ICE

2009-10-15 Thread jakub at gcc dot gnu dot org


-- 

jakub at gcc dot gnu dot org changed:

   What|Removed |Added

   Target Milestone|4.4.2   |4.4.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40808



[Bug c++/40808] [4.4/4.5 regression] member template specialization causes ICE

2009-08-31 Thread mmitchel at gcc dot gnu dot org


-- 

mmitchel at gcc dot gnu dot org changed:

   What|Removed |Added

   Priority|P3  |P2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40808



[Bug c++/40808] [4.4/4.5 regression] member template specialization causes ICE

2009-08-25 Thread bangerth at gmail dot com


--- Comment #1 from bangerth at gmail dot com  2009-08-25 14:16 ---
Confirmed. An ICE. I haven't checked the accepts-invalid part.


-- 

bangerth at gmail dot com changed:

   What|Removed |Added

 CC||bangerth at gmail dot com
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2009-08-25 14:16:58
   date||
Summary|member template |[4.4/4.5 regression] member
   |specialization causes ICE   |template specialization
   ||causes ICE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40808



[Bug c++/40808] [4.4/4.5 regression] member template specialization causes ICE

2009-08-25 Thread jsm28 at gcc dot gnu dot org


-- 

jsm28 at gcc dot gnu dot org changed:

   What|Removed |Added

   Target Milestone|--- |4.4.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40808