public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13445] New: Template argument replacement "dereferences" a typedef
@ 2003-12-19 15:34 brad dot king at kitware dot com
  2003-12-19 15:59 ` [Bug c++/13445] [3.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: brad dot king at kitware dot com @ 2003-12-19 15:34 UTC (permalink / raw)
  To: gcc-bugs

Every version of gcc 3.3.2 I've tested has the bug.  I built a copy by
downloading sources from ftp.gnu.org to be sure no distribution-specific patches
were to blame:

../gcc-3.3.2/configure \
  --prefix=/home/kingb/Temp/gcc-3.3.2-install \
  --enable-languages=c,c++
make bootstrap
make install

"g++ --version" reports "g++ (GCC) 3.3.2"

The following code reproduces the problem.  It is expected to compile without error:

template <class T> class NestedBase {};
template <class T> class Base { protected: typedef int Protected; };
template <class T> struct Derived: public Base<T>
{
  typedef typename Base<T>::Protected Public;
  class Nested: public NestedBase<Public> {};
};
template class Derived<int>::Nested;

Compiling the source with "./g++ -c bug.cxx" produces this error:

bug.cxx: In instantiation of `Derived<int>::Nested':
bug.cxx:8:   instantiated from here
bug.cxx:2: error: `typedef int Base<int>::Protected' is protected
bug.cxx:8: error: within this context

We see that the "Public" typedef is "dereferenced" while instantiating the
template member class "Nested", which produces the access violation.

Compiling the same source with g++ 3.2.3 or any earlier GCC version produces no
error.

-- 
           Summary: Template argument replacement "dereferences" a typedef
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: brad dot king at kitware dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/13445] [3.3 Regression] Template argument replacement "dereferences" a typedef
  2003-12-19 15:34 [Bug c++/13445] New: Template argument replacement "dereferences" a typedef brad dot king at kitware dot com
@ 2003-12-19 15:59 ` pinskia at gcc dot gnu dot org
  2003-12-19 17:05 ` bangerth at dealii dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-19 15:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-19 15:39 -------
Broken: Search converges between 2002-07-14-trunk (#81) and 2002-07-21-trunk (#82).
Fixed on the mainline: Search converges between 2003-08-17-trunk (#375) and 2003-08-18-
trunk (#376).
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2003-12-19 15:39:19
               date|                            |
            Summary|Template argument           |[3.3 Regression] Template
                   |replacement "dereferences" a|argument replacement
                   |typedef                     |"dereferences" a typedef
   Target Milestone|---                         |3.3.3


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


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

* [Bug c++/13445] [3.3 Regression] Template argument replacement "dereferences" a typedef
  2003-12-19 15:34 [Bug c++/13445] New: Template argument replacement "dereferences" a typedef brad dot king at kitware dot com
  2003-12-19 15:59 ` [Bug c++/13445] [3.3 Regression] " pinskia at gcc dot gnu dot org
@ 2003-12-19 17:05 ` bangerth at dealii dot org
  2003-12-19 17:20 ` bangerth at dealii dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2003-12-19 17:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2003-12-19 16:41 -------
Yup, this is bogus. It works on mainline, though. Kriang, you are the 
friendship expert, any chance to get this fixed on the branch? It is a 
regression with respect to 3.2.x. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lerdsuwa at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c++/13445] [3.3 Regression] Template argument replacement "dereferences" a typedef
  2003-12-19 15:34 [Bug c++/13445] New: Template argument replacement "dereferences" a typedef brad dot king at kitware dot com
  2003-12-19 15:59 ` [Bug c++/13445] [3.3 Regression] " pinskia at gcc dot gnu dot org
  2003-12-19 17:05 ` bangerth at dealii dot org
@ 2003-12-19 17:20 ` bangerth at dealii dot org
  2003-12-19 20:23 ` brad dot king at kitware dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2003-12-19 17:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2003-12-19 16:41 -------
Sorry, this has nothing to do with friendship, of course, and all 
with access control. 
W. 

-- 


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


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

* [Bug c++/13445] [3.3 Regression] Template argument replacement "dereferences" a typedef
  2003-12-19 15:34 [Bug c++/13445] New: Template argument replacement "dereferences" a typedef brad dot king at kitware dot com
                   ` (2 preceding siblings ...)
  2003-12-19 17:20 ` bangerth at dealii dot org
@ 2003-12-19 20:23 ` brad dot king at kitware dot com
  2003-12-19 20:25 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: brad dot king at kitware dot com @ 2003-12-19 20:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From brad dot king at kitware dot com  2003-12-19 19:45 -------
I've discovered that applying this patch manually fixes the bug:

http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?r1=1.758&r2=1.759

I am unable to confirm whether it introduces any other bugs when included in the
3.3 branch.

-- 


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


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

* [Bug c++/13445] [3.3 Regression] Template argument replacement "dereferences" a typedef
  2003-12-19 15:34 [Bug c++/13445] New: Template argument replacement "dereferences" a typedef brad dot king at kitware dot com
                   ` (3 preceding siblings ...)
  2003-12-19 20:23 ` brad dot king at kitware dot com
@ 2003-12-19 20:25 ` pinskia at gcc dot gnu dot org
  2003-12-29 18:49 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-19 20:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-19 19:51 -------
It does look like that is the patch fixes it.
Nathan could you backport this patch for 3.3.3:
cp:
        * pt.c (instantiate_class_template): Push to class's scope before
        tsubsting base.
testsuite:
        * g++.dg/template/scope2.C: New test.
        * g++.dg/template/error2.C: Correct dg-error

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |nathan at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/13445] [3.3 Regression] Template argument replacement "dereferences" a typedef
  2003-12-19 15:34 [Bug c++/13445] New: Template argument replacement "dereferences" a typedef brad dot king at kitware dot com
                   ` (4 preceding siblings ...)
  2003-12-19 20:25 ` pinskia at gcc dot gnu dot org
@ 2003-12-29 18:49 ` pinskia at gcc dot gnu dot org
  2003-12-30 10:07 ` cvs-commit at gcc dot gnu dot org
  2003-12-30 10:42 ` nathan at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-29 18:49 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical


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


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

* [Bug c++/13445] [3.3 Regression] Template argument replacement "dereferences" a typedef
  2003-12-19 15:34 [Bug c++/13445] New: Template argument replacement "dereferences" a typedef brad dot king at kitware dot com
                   ` (5 preceding siblings ...)
  2003-12-29 18:49 ` pinskia at gcc dot gnu dot org
@ 2003-12-30 10:07 ` cvs-commit at gcc dot gnu dot org
  2003-12-30 10:42 ` nathan at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-12-30 10:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-12-30 09:47 -------
Subject: Bug 13445

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	nathan@gcc.gnu.org	2003-12-30 09:47:32

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

Log message:
	cp:
	PR c++/13445
	* pt.c (instantiate_class_template): Push to class's scope before
	tsubsting base.
	testsuite:
	PR c++/13445
	* g++.dg/template/scope2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.231&r2=1.3076.2.232
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.635.2.39&r2=1.635.2.40
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.347&r2=1.2261.2.348
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/scope2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.24.1



-- 


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


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

* [Bug c++/13445] [3.3 Regression] Template argument replacement "dereferences" a typedef
  2003-12-19 15:34 [Bug c++/13445] New: Template argument replacement "dereferences" a typedef brad dot king at kitware dot com
                   ` (6 preceding siblings ...)
  2003-12-30 10:07 ` cvs-commit at gcc dot gnu dot org
@ 2003-12-30 10:42 ` nathan at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: nathan at gcc dot gnu dot org @ 2003-12-30 10:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nathan at gcc dot gnu dot org  2003-12-30 09:49 -------
2003-12-30  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/13445
	* pt.c (instantiate_class_template): Push to class's scope before
	tsubsting base.

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


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


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

end of thread, other threads:[~2003-12-30  9:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-19 15:34 [Bug c++/13445] New: Template argument replacement "dereferences" a typedef brad dot king at kitware dot com
2003-12-19 15:59 ` [Bug c++/13445] [3.3 Regression] " pinskia at gcc dot gnu dot org
2003-12-19 17:05 ` bangerth at dealii dot org
2003-12-19 17:20 ` bangerth at dealii dot org
2003-12-19 20:23 ` brad dot king at kitware dot com
2003-12-19 20:25 ` pinskia at gcc dot gnu dot org
2003-12-29 18:49 ` pinskia at gcc dot gnu dot org
2003-12-30 10:07 ` cvs-commit at gcc dot gnu dot org
2003-12-30 10:42 ` nathan 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).