public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30818]  New: [4.1.2 Regression] templates and typedefs cause function prototype not to match
@ 2007-02-16 10:30 sschunck at pdf dot de
  2007-02-16 11:25 ` [Bug c++/30818] [4.1/4.2/4.3 " rguenth at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: sschunck at pdf dot de @ 2007-02-16 10:30 UTC (permalink / raw)
  To: gcc-bugs

the following compiled fine on gcc-3.4.6 but gives error on gcc-4.1.2

error: prototype for 'typename A<T>::B::type A<T>::B::f()' does not match any
in class 'A<T>::B'
error: candidate is: typename A<T>::type A<T>::B::f()
error: template definition of non-template 'typename A<T>::B::type
A<T>::B::f()'


template < typename T > 
class A 
{
        typedef int type;
        class B;
};

template < typename T >
class A<T>::B
{
        typedef typename A<T>::type type;
        type g() { return 0;}
        type f();
};

template < typename T >
typename A<T>::B::type 
A<T>::B::f() { return 0; }

( I have no vanilla gcc available, so hopefully gentoo guys did not screw up
gcc-4.1.2 )

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with:
/home/portage/portage/sys-devel/gcc-4.1.2/work/gcc-4.1.2/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.1.2
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.2
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.2/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.2/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec
--enable-nls --without-included-gettext --with-system-zlib --disable-checking
--disable-werror --enable-secureplt --disable-libunwind-exceptions
--disable-multilib --disable-libmudflap --disable-libssp --disable-libgcj
--enable-languages=c,c++,fortran --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 4.1.2 (Gentoo 4.1.2)


-- 
           Summary: [4.1.2 Regression] templates and typedefs cause function
                    prototype not to match
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sschunck at pdf dot de
  GCC host triplet: i686-pc-linux


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


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

* [Bug c++/30818] [4.1/4.2/4.3 Regression] templates and typedefs cause function prototype not to match
  2007-02-16 10:30 [Bug c++/30818] New: [4.1.2 Regression] templates and typedefs cause function prototype not to match sschunck at pdf dot de
@ 2007-02-16 11:25 ` rguenth at gcc dot gnu dot org
  2007-02-16 13:47 ` rguenth at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-02-16 11:25 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1411 bytes --]



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-02-16 11:25 -------
EDG happily eats this.  With mainline the error looks like

t.ii:18: error: prototype for ‘typename A<T>::B::type A<T>::B::f()’ does not
match any in class ‘A<T>::B’
t.ii:13: error: candidate is: typename A<T>::type A<T>::B::f()
t.ii:18: error: ‘typename A<T>::B::type A<T>::B::f()’ cannot be overloaded
t.ii:13: error: with ‘typename A<T>::type A<T>::B::f()’
t.ii:18: error: template definition of non-template ‘typename A<T>::B::type
A<T>::B::f()’


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
      Known to fail|4.1.2                       |4.1.2 4.2.0 4.3.0
   Last reconfirmed|0000-00-00 00:00:00         |2007-02-16 11:25:02
               date|                            |
            Summary|[4.1.2 Regression] templates|[4.1/4.2/4.3 Regression]
                   |and typedefs cause function |templates and typedefs cause
                   |prototype not to match      |function prototype not to
                   |                            |match


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


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

* [Bug c++/30818] [4.1/4.2/4.3 Regression] templates and typedefs cause function prototype not to match
  2007-02-16 10:30 [Bug c++/30818] New: [4.1.2 Regression] templates and typedefs cause function prototype not to match sschunck at pdf dot de
  2007-02-16 11:25 ` [Bug c++/30818] [4.1/4.2/4.3 " rguenth at gcc dot gnu dot org
@ 2007-02-16 13:47 ` rguenth at gcc dot gnu dot org
  2007-02-21 15:23 ` rguenth at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-02-16 13:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2007-02-16 13:46 -------
*** Bug 30821 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug c++/30818] [4.1/4.2/4.3 Regression] templates and typedefs cause function prototype not to match
  2007-02-16 10:30 [Bug c++/30818] New: [4.1.2 Regression] templates and typedefs cause function prototype not to match sschunck at pdf dot de
  2007-02-16 11:25 ` [Bug c++/30818] [4.1/4.2/4.3 " rguenth at gcc dot gnu dot org
  2007-02-16 13:47 ` rguenth at gcc dot gnu dot org
@ 2007-02-21 15:23 ` rguenth at gcc dot gnu dot org
  2007-03-05  3:58 ` mmitchel at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-02-21 15:23 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.3


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


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

* [Bug c++/30818] [4.1/4.2/4.3 Regression] templates and typedefs cause function prototype not to match
  2007-02-16 10:30 [Bug c++/30818] New: [4.1.2 Regression] templates and typedefs cause function prototype not to match sschunck at pdf dot de
                   ` (2 preceding siblings ...)
  2007-02-21 15:23 ` rguenth at gcc dot gnu dot org
@ 2007-03-05  3:58 ` mmitchel at gcc dot gnu dot org
  2007-04-23 21:26 ` janis at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-03-05  3:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug c++/30818] [4.1/4.2/4.3 Regression] templates and typedefs cause function prototype not to match
  2007-02-16 10:30 [Bug c++/30818] New: [4.1.2 Regression] templates and typedefs cause function prototype not to match sschunck at pdf dot de
                   ` (3 preceding siblings ...)
  2007-03-05  3:58 ` mmitchel at gcc dot gnu dot org
@ 2007-04-23 21:26 ` janis at gcc dot gnu dot org
  2007-04-23 21:29 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: janis at gcc dot gnu dot org @ 2007-04-23 21:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from janis at gcc dot gnu dot org  2007-04-23 22:26 -------
A regression hunt on powerpc-linux identified this mainline patch:

    http://gcc.gnu.org/viewcvs?view=rev&rev=116409

    r116409 | nathan | 2006-08-25 09:56:07 -0700 (Fri, 25 Aug 2006)

This patch was backported to the 4.1 branch on 2006-10-18.


-- 

janis at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org, nathan at gcc dot gnu
                   |                            |dot org


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


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

* [Bug c++/30818] [4.1/4.2/4.3 Regression] templates and typedefs cause function prototype not to match
  2007-02-16 10:30 [Bug c++/30818] New: [4.1.2 Regression] templates and typedefs cause function prototype not to match sschunck at pdf dot de
                   ` (4 preceding siblings ...)
  2007-04-23 21:26 ` janis at gcc dot gnu dot org
@ 2007-04-23 21:29 ` pinskia at gcc dot gnu dot org
  2007-07-21 20:51 ` nathan at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-23 21:29 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
  BugsThisDependsOn|                            |27787
           Severity|normal                      |critical
      Known to work|3.4.6                       |3.4.6 4.1.1


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


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

* [Bug c++/30818] [4.1/4.2/4.3 Regression] templates and typedefs cause function prototype not to match
  2007-02-16 10:30 [Bug c++/30818] New: [4.1.2 Regression] templates and typedefs cause function prototype not to match sschunck at pdf dot de
                   ` (5 preceding siblings ...)
  2007-04-23 21:29 ` pinskia at gcc dot gnu dot org
@ 2007-07-21 20:51 ` nathan at gcc dot gnu dot org
  2007-07-22 16:26 ` nathan at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: nathan at gcc dot gnu dot org @ 2007-07-21 20:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from nathan at gcc dot gnu dot org  2007-07-21 20:50 -------
testing a patch


-- 

nathan at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |nathan at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-02-16 11:25:02         |2007-07-21 20:50:59
               date|                            |


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


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

* [Bug c++/30818] [4.1/4.2/4.3 Regression] templates and typedefs cause function prototype not to match
  2007-02-16 10:30 [Bug c++/30818] New: [4.1.2 Regression] templates and typedefs cause function prototype not to match sschunck at pdf dot de
                   ` (6 preceding siblings ...)
  2007-07-21 20:51 ` nathan at gcc dot gnu dot org
@ 2007-07-22 16:26 ` nathan at gcc dot gnu dot org
  2007-07-22 16:34 ` nathan at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: nathan at gcc dot gnu dot org @ 2007-07-22 16:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from nathan at gcc dot gnu dot org  2007-07-22 16:26 -------
Subject: Bug 30818

Author: nathan
Date: Sun Jul 22 16:25:54 2007
New Revision: 126825

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126825
Log:
cp/
        PR c++/30818
        * typeck.c (structural_comptypes): No need to check
        resolve_typename_type return value here.
        * cp-tree.h (TYPENAME_IS_RESOLVING_P): New.
        * pt.c (resolve_typename_type): Follow typename typedefs.  Return
        original type rather than error_mark_node in case of failure.
        * parser.c (cp_parser_nested_name_specifier_opt): Adjust
        resolve_typename_type result check.
        (cp_parser_direct_declarator, cp_parser_head,
        cp_parser_constructor_declarator_p): Likewise.

testsuite/
        PR c++/30818
        * g++.dg/template/crash47.C: Adjust errors.
        * g++.dg/template/crash48.C: Adjust errors.
        * g++.dg/template/typename12.C: New.
        * g++.dg/template/typename13.C: New.
        * g++.dg/template/typename14.C: New.
        * g++.dg/template/typedef6.C: Adjust errors.

Added:
    trunk/gcc/testsuite/g++.dg/template/typename12.C
    trunk/gcc/testsuite/g++.dg/template/typename13.C
    trunk/gcc/testsuite/g++.dg/template/typename14.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/template/crash47.C
    trunk/gcc/testsuite/g++.dg/template/crash48.C
    trunk/gcc/testsuite/g++.dg/template/typedef6.C


-- 


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


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

* [Bug c++/30818] [4.1/4.2/4.3 Regression] templates and typedefs cause function prototype not to match
  2007-02-16 10:30 [Bug c++/30818] New: [4.1.2 Regression] templates and typedefs cause function prototype not to match sschunck at pdf dot de
                   ` (7 preceding siblings ...)
  2007-07-22 16:26 ` nathan at gcc dot gnu dot org
@ 2007-07-22 16:34 ` nathan at gcc dot gnu dot org
  2007-07-23 19:24 ` [Bug c++/30818] [4.1/4.2 " rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: nathan at gcc dot gnu dot org @ 2007-07-22 16:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from nathan at gcc dot gnu dot org  2007-07-22 16:33 -------
fixed with http://gcc.gnu.org/ml/gcc-patches/2007-07/msg01644.html


        cp/
        PR c++/30818
        * typeck.c (structural_comptypes): No need to check
        resolve_typename_type return value here.
        * cp-tree.h (TYPENAME_IS_RESOLVING_P): New.
        * pt.c (resolve_typename_type): Follow typename typedefs.  Return
        original type rather than error_mark_node in case of failure.
        * parser.c (cp_parser_nested_name_specifier_opt): Adjust
        resolve_typename_type result check.
        (cp_parser_direct_declarator, cp_parser_head,
        cp_parser_constructor_declarator_p): Likewise.

        testsuite/
        PR c++/30818
        * g++.dg/template/crash47.C: Adjust errors.
        * g++.dg/template/crash48.C: Adjust errors.
        * g++.dg/template/typename12.C: New.
        * g++.dg/template/typename13.C: New.
        * g++.dg/template/typename14.C: New.
        * g++.dg/template/typedef6.C: Adjust errors.

the patch should backport painlessly to 4.2


-- 

nathan at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/30818] [4.1/4.2 Regression] templates and typedefs cause function prototype not to match
  2007-02-16 10:30 [Bug c++/30818] New: [4.1.2 Regression] templates and typedefs cause function prototype not to match sschunck at pdf dot de
                   ` (8 preceding siblings ...)
  2007-07-22 16:34 ` nathan at gcc dot gnu dot org
@ 2007-07-23 19:24 ` rguenth at gcc dot gnu dot org
  2008-07-04 21:58 ` [Bug c++/30818] [4.2 " jsm28 at gcc dot gnu dot org
  2009-03-30 21:35 ` jsm28 at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-07-23 19:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2007-07-23 19:24 -------
Re-open, as the branches are still affected and this is a regression.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
      Known to fail|4.1.2 4.2.0 4.3.0           |4.1.2 4.2.0
      Known to work|3.4.6 4.1.1                 |3.4.6 4.1.1 4.3.0
         Resolution|FIXED                       |
            Summary|[4.1/4.2/4.3 Regression]    |[4.1/4.2 Regression]
                   |templates and typedefs cause|templates and typedefs cause
                   |function prototype not to   |function prototype not to
                   |match                       |match


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


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

* [Bug c++/30818] [4.2 Regression] templates and typedefs cause function prototype not to match
  2007-02-16 10:30 [Bug c++/30818] New: [4.1.2 Regression] templates and typedefs cause function prototype not to match sschunck at pdf dot de
                   ` (9 preceding siblings ...)
  2007-07-23 19:24 ` [Bug c++/30818] [4.1/4.2 " rguenth at gcc dot gnu dot org
@ 2008-07-04 21:58 ` jsm28 at gcc dot gnu dot org
  2009-03-30 21:35 ` jsm28 at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 21:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jsm28 at gcc dot gnu dot org  2008-07-04 21:57 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 Regression]        |[4.2 Regression] templates
                   |templates and typedefs cause|and typedefs cause function
                   |function prototype not to   |prototype not to match
                   |match                       |
   Target Milestone|4.1.3                       |4.2.5


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


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

* [Bug c++/30818] [4.2 Regression] templates and typedefs cause function prototype not to match
  2007-02-16 10:30 [Bug c++/30818] New: [4.1.2 Regression] templates and typedefs cause function prototype not to match sschunck at pdf dot de
                   ` (10 preceding siblings ...)
  2008-07-04 21:58 ` [Bug c++/30818] [4.2 " jsm28 at gcc dot gnu dot org
@ 2009-03-30 21:35 ` jsm28 at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-30 21:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jsm28 at gcc dot gnu dot org  2009-03-30 21:35 -------
Closing 4.2 branch, fixed in 4.3.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
      Known to fail|4.1.2 4.2.0                 |4.1.2 4.2.0 4.2.5
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.0


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


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

end of thread, other threads:[~2009-03-30 21:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-16 10:30 [Bug c++/30818] New: [4.1.2 Regression] templates and typedefs cause function prototype not to match sschunck at pdf dot de
2007-02-16 11:25 ` [Bug c++/30818] [4.1/4.2/4.3 " rguenth at gcc dot gnu dot org
2007-02-16 13:47 ` rguenth at gcc dot gnu dot org
2007-02-21 15:23 ` rguenth at gcc dot gnu dot org
2007-03-05  3:58 ` mmitchel at gcc dot gnu dot org
2007-04-23 21:26 ` janis at gcc dot gnu dot org
2007-04-23 21:29 ` pinskia at gcc dot gnu dot org
2007-07-21 20:51 ` nathan at gcc dot gnu dot org
2007-07-22 16:26 ` nathan at gcc dot gnu dot org
2007-07-22 16:34 ` nathan at gcc dot gnu dot org
2007-07-23 19:24 ` [Bug c++/30818] [4.1/4.2 " rguenth at gcc dot gnu dot org
2008-07-04 21:58 ` [Bug c++/30818] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 21:35 ` jsm28 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).