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

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).