public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47125] New: ICE occurs in combination with partial specialization and invalid template function.
@ 2010-12-29 19:49 flast at flast dot jp
  2010-12-29 19:51 ` [Bug c++/47125] " flast at flast dot jp
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: flast at flast dot jp @ 2010-12-29 19:49 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: ICE occurs in combination with partial specialization
                    and invalid template function.
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: flast@flast.jp


compiler output:
$ g++-4.5 testcase.cpp
testcase.cpp: In function 'void g()':
testcase.cpp:17:17: error: 'class enable_if<true, T>::type' resolves to
'enable_if<true, int>::type', which is is not a class type
testcase.cpp:17:17: error: 'class enable_if<true, T>::type' resolves to
'enable_if<true, int>::type', which is is not a class type
testcase.cpp:12:1: error: 'class enable_if<true, T>::type' resolves to
'enable_if<true, int>::type', which is is not a class type

Internal compiler error: Error reporting routines re-entered.
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

tested version:
4.4.4-14ubuntu5 - OK
4.5.1 - Crash
4.5.2 - Crash
4.6.0 r168322 - Crash


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

* [Bug c++/47125] ICE occurs in combination with partial specialization and invalid template function.
  2010-12-29 19:49 [Bug c++/47125] New: ICE occurs in combination with partial specialization and invalid template function flast at flast dot jp
@ 2010-12-29 19:51 ` flast at flast dot jp
  2010-12-29 21:13 ` [Bug c++/47125] [4.5/4.6 Regression] " hjl.tools at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: flast at flast dot jp @ 2010-12-29 19:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Kohei Takahashi <flast at flast dot jp> 2010-12-29 19:51:04 UTC ---
Created attachment 22867
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22867
test code


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

* [Bug c++/47125] [4.5/4.6 Regression] ICE occurs in combination with partial specialization and invalid template function.
  2010-12-29 19:49 [Bug c++/47125] New: ICE occurs in combination with partial specialization and invalid template function flast at flast dot jp
  2010-12-29 19:51 ` [Bug c++/47125] " flast at flast dot jp
@ 2010-12-29 21:13 ` hjl.tools at gmail dot com
  2011-01-03 21:41 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2010-12-29 21:13 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.12.29 21:13:38
                 CC|                            |jason at redhat dot com
   Target Milestone|---                         |4.5.3
            Summary|ICE occurs in combination   |[4.5/4.6 Regression] ICE
                   |with partial specialization |occurs in combination with
                   |and invalid template        |partial specialization and
                   |function.                   |invalid template function.
     Ever Confirmed|0                           |1

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2010-12-29 21:13:38 UTC ---
It is caused by revision 145476:

http://gcc.gnu.org/ml/gcc-cvs/2009-04/msg00097.html


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

* [Bug c++/47125] [4.5/4.6 Regression] ICE occurs in combination with partial specialization and invalid template function.
  2010-12-29 19:49 [Bug c++/47125] New: ICE occurs in combination with partial specialization and invalid template function flast at flast dot jp
  2010-12-29 19:51 ` [Bug c++/47125] " flast at flast dot jp
  2010-12-29 21:13 ` [Bug c++/47125] [4.5/4.6 Regression] " hjl.tools at gmail dot com
@ 2011-01-03 21:41 ` rguenth at gcc dot gnu.org
  2011-03-11 21:03 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-03 21:41 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery
           Priority|P3                          |P5


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

* [Bug c++/47125] [4.5/4.6 Regression] ICE occurs in combination with partial specialization and invalid template function.
  2010-12-29 19:49 [Bug c++/47125] New: ICE occurs in combination with partial specialization and invalid template function flast at flast dot jp
                   ` (2 preceding siblings ...)
  2011-01-03 21:41 ` rguenth at gcc dot gnu.org
@ 2011-03-11 21:03 ` jason at gcc dot gnu.org
  2011-03-12  6:49 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-03-11 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |


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

* [Bug c++/47125] [4.5/4.6 Regression] ICE occurs in combination with partial specialization and invalid template function.
  2010-12-29 19:49 [Bug c++/47125] New: ICE occurs in combination with partial specialization and invalid template function flast at flast dot jp
                   ` (3 preceding siblings ...)
  2011-03-11 21:03 ` jason at gcc dot gnu.org
@ 2011-03-12  6:49 ` jason at gcc dot gnu.org
  2011-03-13  1:17 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-03-12  6:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-12 06:49:01 UTC ---
Author: jason
Date: Sat Mar 12 06:48:57 2011
New Revision: 170896

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170896
Log:
    PR c++/47125
    * pt.c (tsubst) [TYPENAME_TYPE]: Only give errors if tf_error.

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


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

* [Bug c++/47125] [4.5/4.6 Regression] ICE occurs in combination with partial specialization and invalid template function.
  2010-12-29 19:49 [Bug c++/47125] New: ICE occurs in combination with partial specialization and invalid template function flast at flast dot jp
                   ` (4 preceding siblings ...)
  2011-03-12  6:49 ` jason at gcc dot gnu.org
@ 2011-03-13  1:17 ` jason at gcc dot gnu.org
  2011-03-14  5:02 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-03-13  1:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-13 01:17:17 UTC ---
Author: jason
Date: Sun Mar 13 01:17:14 2011
New Revision: 170919

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170919
Log:
    PR c++/47125
    * pt.c (tsubst) [TYPENAME_TYPE]: Only give errors if tf_error.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/template/error45.C
Modified:
    branches/gcc-4_5-branch/gcc/cp/ChangeLog
    branches/gcc-4_5-branch/gcc/cp/pt.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog


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

* [Bug c++/47125] [4.5/4.6 Regression] ICE occurs in combination with partial specialization and invalid template function.
  2010-12-29 19:49 [Bug c++/47125] New: ICE occurs in combination with partial specialization and invalid template function flast at flast dot jp
                   ` (5 preceding siblings ...)
  2011-03-13  1:17 ` jason at gcc dot gnu.org
@ 2011-03-14  5:02 ` jason at gcc dot gnu.org
  2011-03-30  0:28 ` flast at flast dot jp
  2011-03-30  2:36 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-03-14  5:02 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-14 05:02:08 UTC ---
Fixed.


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

* [Bug c++/47125] [4.5/4.6 Regression] ICE occurs in combination with partial specialization and invalid template function.
  2010-12-29 19:49 [Bug c++/47125] New: ICE occurs in combination with partial specialization and invalid template function flast at flast dot jp
                   ` (6 preceding siblings ...)
  2011-03-14  5:02 ` jason at gcc dot gnu.org
@ 2011-03-30  0:28 ` flast at flast dot jp
  2011-03-30  2:36 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: flast at flast dot jp @ 2011-03-30  0:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Kohei Takahashi <flast at flast dot jp> 2011-03-30 00:12:12 UTC ---
It works good now. However GCC shows following error message.
----
testcase.cpp: In function 'void g()':
testcase.cpp:17:10: error: no matching function for call to 'f(int)'
testcase.cpp:17:10: note: candidate is:
testcase.cpp:12:8: note: template<class T> class enable_if<true, T>::type f(T)

I think error message like followings is better.
----
testcase.cpp:11:1: error: need 'typename' before 'enable_if<true, T>::type'
because 'enable_if<true, T>' is a dependent scope
testcase.cpp: In function 'void g()':
testcase.cpp:17:10: error: 'f' was not declared in this scope


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

* [Bug c++/47125] [4.5/4.6 Regression] ICE occurs in combination with partial specialization and invalid template function.
  2010-12-29 19:49 [Bug c++/47125] New: ICE occurs in combination with partial specialization and invalid template function flast at flast dot jp
                   ` (7 preceding siblings ...)
  2011-03-30  0:28 ` flast at flast dot jp
@ 2011-03-30  2:36 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-03-30  2:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-30 02:27:45 UTC ---
(In reply to comment #6)
> I think error message like followings is better.
> ----
> testcase.cpp:11:1: error: need 'typename' before 'enable_if<true, T>::type'
> because 'enable_if<true, T>' is a dependent scope

You don't need 'typename' there because you have 'struct'.  14.6/5:

"A qualified name used as the name in a mem-initializer-id, a base-specifier,
or an elaborated-type-specifier is implicitly assumed to name a type, without
the use of the typename keyword."

But 'int' is not a struct, so substituting 'int' into struct
enable_if<true,T>::type fails.  So a better error message would be

testcase.cpp:12:8: note: template<class T> class enable_if<true, T>::type f(T)
testcase.cpp:12:8: note:    'class enable_if<true,int>::type' resolves to
'int', which is not a class type

currently we don't attempt to explain SFINAE when printing candidates, but that
would be a useful thing to do.


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

end of thread, other threads:[~2011-03-30  2:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-29 19:49 [Bug c++/47125] New: ICE occurs in combination with partial specialization and invalid template function flast at flast dot jp
2010-12-29 19:51 ` [Bug c++/47125] " flast at flast dot jp
2010-12-29 21:13 ` [Bug c++/47125] [4.5/4.6 Regression] " hjl.tools at gmail dot com
2011-01-03 21:41 ` rguenth at gcc dot gnu.org
2011-03-11 21:03 ` jason at gcc dot gnu.org
2011-03-12  6:49 ` jason at gcc dot gnu.org
2011-03-13  1:17 ` jason at gcc dot gnu.org
2011-03-14  5:02 ` jason at gcc dot gnu.org
2011-03-30  0:28 ` flast at flast dot jp
2011-03-30  2:36 ` jason at gcc dot gnu.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).