This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11418] implicit typename extension leads to wrong code
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Jul 2003 16:45:49 -0000
- Subject: [Bug c++/11418] implicit typename extension leads to wrong code
- References: <20030703021503.11418.GccBugs@Skyler.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11418
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Summary|Nested template as arg to |implicit typename extension
|base class template confuses|leads to wrong code
|args |
------- Additional Comments From bangerth at dealii dot org 2003-07-03 16:45 -------
Very interesting failure. In fact, I can confirm this with 3.2.x and 3.3,
but it is fixed in mainline (see below).
In essence: the code is wrong -- but previous versions of gcc accept
it via the implicit typename extension. Here's the line:
struct Derived : public Base<Outer<U>::Inner<T> > { };
3.2 and 3.3 accept this line, but 3.4 rejects it, as it should
read correctly as
struct Derived : public Base<typename Outer<U>::template Inner<T> > { };
Now, the amazing thing is that 3.2 and 3.3 generate the _wrong_ output for
the first line, and the correct one for the second. Since 3.4 only accepts
the last one, it always generates the correct output. Very interesting,
indeed.
So the proper workaround is to correct your code and don't rely on broken
gcc extensions :-(
Wolfgang