public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails
@ 2004-08-21 20:52 achovane at engin dot umich dot edu
  2004-08-21 20:53 ` [Bug c++/17132] " achovane at engin dot umich dot edu
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: achovane at engin dot umich dot edu @ 2004-08-21 20:52 UTC (permalink / raw)
  To: gcc-bugs

When compiling test_no_amperspand.cpp, GCC generates the following error:

"error: `operator*' is not a member of type `empty'"

GCC attempts to instantiate a specialization of the function template 'test' 
which accepts a parameter of type `func_tag<Type, Type::operator*> *' with a 
default value of 0.

Since type 'empty' is a struct which does not overload `operator*', this 
specialization should not be included in the set of candidate functions for the 
call to `test' on line 19, according to the SFINAE (substitution-failure-is-not 
an-error) principle.

The C++ Standard states:

"... For each function template, if the argument deduction and checking 
succeeds, the template-arguments (deduced and/or explicit) are used to 
instantiate a single function template specialization which is added to the 
candidate functions set to be used in overload resolution. If, for a given 
function template, argument deduction fails, no such function is added to the 
set of candidate functions for that template."

Since a non-template function `test' is defined which accepts a parameter of 
type `void *', the call on 19 is satisfied. Thus, this program is correct and 
should compile.


The second file, test_amperspand.cpp, is identical to the first, except that on 
line 14, `Type::operator*' is replaced with `&Type::operator*'. (Both forms are 
correct.)

In the latter case (test_amperspand.cpp), GCC generates the following error:

"internal compiler error: Segmentation fault"


Both of these programs compile without error under Intel C++ 8.0 and Comeau 
C/C++ 4.3.0.

-- 
           Summary: GCC fails to eliminate function template specialization
                    when argument deduction fails
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: achovane at engin dot umich dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/17132] GCC fails to eliminate function template specialization when argument deduction fails
  2004-08-21 20:52 [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails achovane at engin dot umich dot edu
@ 2004-08-21 20:53 ` achovane at engin dot umich dot edu
  2004-08-21 20:54 ` achovane at engin dot umich dot edu
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: achovane at engin dot umich dot edu @ 2004-08-21 20:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From achovane at engin dot umich dot edu  2004-08-21 20:53 -------
Created an attachment (id=6971)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6971&action=view)
first version of source file


-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/17132] GCC fails to eliminate function template specialization when argument deduction fails
  2004-08-21 20:52 [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails achovane at engin dot umich dot edu
  2004-08-21 20:53 ` [Bug c++/17132] " achovane at engin dot umich dot edu
@ 2004-08-21 20:54 ` achovane at engin dot umich dot edu
  2004-08-21 20:55 ` achovane at engin dot umich dot edu
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: achovane at engin dot umich dot edu @ 2004-08-21 20:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From achovane at engin dot umich dot edu  2004-08-21 20:54 -------
Created an attachment (id=6972)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6972&action=view)
compiler output for first version of source file


-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/17132] GCC fails to eliminate function template specialization when argument deduction fails
  2004-08-21 20:52 [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails achovane at engin dot umich dot edu
                   ` (2 preceding siblings ...)
  2004-08-21 20:55 ` achovane at engin dot umich dot edu
@ 2004-08-21 20:55 ` achovane at engin dot umich dot edu
  2004-08-21 21:06 ` [Bug c++/17132] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: achovane at engin dot umich dot edu @ 2004-08-21 20:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From achovane at engin dot umich dot edu  2004-08-21 20:55 -------
Created an attachment (id=6974)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6974&action=view)
compiler output for second version of source file


-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/17132] GCC fails to eliminate function template specialization when argument deduction fails
  2004-08-21 20:52 [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails achovane at engin dot umich dot edu
  2004-08-21 20:53 ` [Bug c++/17132] " achovane at engin dot umich dot edu
  2004-08-21 20:54 ` achovane at engin dot umich dot edu
@ 2004-08-21 20:55 ` achovane at engin dot umich dot edu
  2004-08-21 20:55 ` achovane at engin dot umich dot edu
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: achovane at engin dot umich dot edu @ 2004-08-21 20:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From achovane at engin dot umich dot edu  2004-08-21 20:55 -------
Created an attachment (id=6973)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6973&action=view)
second version of source file


-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/17132] [3.4/3.5 Regression] GCC fails to eliminate function template specialization when argument deduction fails
  2004-08-21 20:52 [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails achovane at engin dot umich dot edu
                   ` (3 preceding siblings ...)
  2004-08-21 20:55 ` achovane at engin dot umich dot edu
@ 2004-08-21 21:06 ` pinskia at gcc dot gnu dot org
  2004-08-21 22:25 ` achovane at engin dot umich dot edu
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-21 21:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-21 21:06 -------
The first one now ICE in 3.4.0 so that is a regression.

Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |ice-on-valid-code, rejects-
                   |                            |valid
      Known to fail|                            |3.4.0 3.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-21 21:06:54
               date|                            |
            Summary|GCC fails to eliminate      |[3.4/3.5 Regression] GCC
                   |function template           |fails to eliminate function
                   |specialization when argument|template specialization when
                   |deduction fails             |argument deduction fails
   Target Milestone|---                         |3.4.2


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/17132] [3.4/3.5 Regression] GCC fails to eliminate function template specialization when argument deduction fails
  2004-08-21 20:52 [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails achovane at engin dot umich dot edu
                   ` (4 preceding siblings ...)
  2004-08-21 21:06 ` [Bug c++/17132] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-08-21 22:25 ` achovane at engin dot umich dot edu
  2004-08-22 17:25 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: achovane at engin dot umich dot edu @ 2004-08-21 22:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From achovane at engin dot umich dot edu  2004-08-21 22:25 -------
I am posting a third source file along with the output that GCC generates when 
I try to compile it.

Here, has_deref is instantiated with a type that defines `operator*', so 
argument deduction should succeed, and the appropriate specialization of the 
`test' function template should be called, because `Type *' is a better match 
than `void *'.

However, in this case GCC generates a different internal compiler error:

"internal compiler error: in mangle_class_name_for_template, at cp/pt.c:3848"



-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/17132] [3.4/3.5 Regression] GCC fails to eliminate function template specialization when argument deduction fails
  2004-08-21 20:52 [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails achovane at engin dot umich dot edu
                   ` (5 preceding siblings ...)
  2004-08-21 22:25 ` achovane at engin dot umich dot edu
@ 2004-08-22 17:25 ` pinskia at gcc dot gnu dot org
  2004-08-29 18:12 ` mmitchel at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-22 17:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-22 17:25 -------
: Search converges between 2003-07-07-trunk (#287) and 2003-07-08-trunk (#288).

-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/17132] [3.4/3.5 Regression] GCC fails to eliminate function template specialization when argument deduction fails
  2004-08-21 20:52 [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails achovane at engin dot umich dot edu
                   ` (6 preceding siblings ...)
  2004-08-22 17:25 ` pinskia at gcc dot gnu dot org
@ 2004-08-29 18:12 ` mmitchel at gcc dot gnu dot org
  2004-08-29 18:16 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-08-29 18:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-08-29 18:11 -------
Postponed until GCC 3.4.3.

-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/17132] [3.4/3.5 Regression] GCC fails to eliminate function template specialization when argument deduction fails
  2004-08-21 20:52 [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails achovane at engin dot umich dot edu
                   ` (7 preceding siblings ...)
  2004-08-29 18:12 ` mmitchel at gcc dot gnu dot org
@ 2004-08-29 18:16 ` mmitchel at gcc dot gnu dot org
  2004-10-28 17:32 ` [Bug c++/17132] [3.4/4.0 " mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-08-29 18:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-08-29 18:14 -------
Postponed until GCC 3.4.3.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.2                       |3.4.3


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/17132] [3.4/4.0 Regression] GCC fails to eliminate function template specialization when argument deduction fails
  2004-08-21 20:52 [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails achovane at engin dot umich dot edu
                   ` (8 preceding siblings ...)
  2004-08-29 18:16 ` mmitchel at gcc dot gnu dot org
@ 2004-10-28 17:32 ` mmitchel at gcc dot gnu dot org
  2004-10-28 20:53 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-10-28 17:32 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED
      Known to fail|3.4.0 4.0                   |3.4.0 4.0.0


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/17132] [3.4/4.0 Regression] GCC fails to eliminate function template specialization when argument deduction fails
  2004-08-21 20:52 [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails achovane at engin dot umich dot edu
                   ` (9 preceding siblings ...)
  2004-10-28 17:32 ` [Bug c++/17132] [3.4/4.0 " mmitchel at gcc dot gnu dot org
@ 2004-10-28 20:53 ` cvs-commit at gcc dot gnu dot org
  2004-10-28 20:56 ` cvs-commit at gcc dot gnu dot org
  2004-10-28 21:01 ` mmitchel at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-10-28 20:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-10-28 20:53 -------
Subject: Bug 17132

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-10-28 20:53:04

Modified files:
	gcc/cp         : ChangeLog pt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: memclass3.C 

Log message:
	PR c++/17132
	* pt.c (instantiate_class_template): Increment
	processing_template_decl when substituting into a member class
	template.
	
	PR c++/17132
	* g++.dg/template/memclass3.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4460&r2=1.4461
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.938&r2=1.939
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4513&r2=1.4514
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/memclass3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/17132] [3.4/4.0 Regression] GCC fails to eliminate function template specialization when argument deduction fails
  2004-08-21 20:52 [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails achovane at engin dot umich dot edu
                   ` (10 preceding siblings ...)
  2004-10-28 20:53 ` cvs-commit at gcc dot gnu dot org
@ 2004-10-28 20:56 ` cvs-commit at gcc dot gnu dot org
  2004-10-28 21:01 ` mmitchel at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-10-28 20:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-10-28 20:56 -------
Subject: Bug 17132

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-10-28 20:56:55

Modified files:
	gcc/cp         : ChangeLog pt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: memclass3.C 

Log message:
	PR c++/17132
	* pt.c (instantiate_class_template): Increment
	processing_template_decl when substituting into a member class
	template.
	
	PR c++/17132
	* g++.dg/template/memclass3.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.175&r2=1.3892.2.176
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.44&r2=1.816.2.45
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.299&r2=1.3389.2.300
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/memclass3.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1



-- 


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/17132] [3.4/4.0 Regression] GCC fails to eliminate function template specialization when argument deduction fails
  2004-08-21 20:52 [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails achovane at engin dot umich dot edu
                   ` (11 preceding siblings ...)
  2004-10-28 20:56 ` cvs-commit at gcc dot gnu dot org
@ 2004-10-28 21:01 ` mmitchel at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-10-28 21:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-10-28 21:00 -------
Fixed in GCC 3.4.3.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-10-28 21:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-21 20:52 [Bug c++/17132] New: GCC fails to eliminate function template specialization when argument deduction fails achovane at engin dot umich dot edu
2004-08-21 20:53 ` [Bug c++/17132] " achovane at engin dot umich dot edu
2004-08-21 20:54 ` achovane at engin dot umich dot edu
2004-08-21 20:55 ` achovane at engin dot umich dot edu
2004-08-21 20:55 ` achovane at engin dot umich dot edu
2004-08-21 21:06 ` [Bug c++/17132] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-08-21 22:25 ` achovane at engin dot umich dot edu
2004-08-22 17:25 ` pinskia at gcc dot gnu dot org
2004-08-29 18:12 ` mmitchel at gcc dot gnu dot org
2004-08-29 18:16 ` mmitchel at gcc dot gnu dot org
2004-10-28 17:32 ` [Bug c++/17132] [3.4/4.0 " mmitchel at gcc dot gnu dot org
2004-10-28 20:53 ` cvs-commit at gcc dot gnu dot org
2004-10-28 20:56 ` cvs-commit at gcc dot gnu dot org
2004-10-28 21:01 ` mmitchel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).