18738 – [3.4 Regression] typename not allowed with non-dependent qualified name (original) (raw)

Description Mikael Kilpeläinen 2004-11-30 13:45:14 UTC

namespace foo { typedef int my_type; }

template struct A { typename foo::my_type bar(); };

$ g++ typename.cpp typename.cpp:8: error: 'my_type' in namespace 'foo' does not name a type

with

$ g++ -v Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/4.0.0/specs Configured with: ../gcc/configure --enable-languages=c++,c --enable- threads=posix Thread model: posix gcc version 4.0.0 20041130 (experimental)

The qualified name does not need to be dependent according to the std03 14.6/5. This seems to be regression from the versions before new parser.

Mikael

Comment 1 Volker Reichelt 2004-12-01 16:30:02 UTC

Confirmed.

Comment 3 Mark Mitchell 2004-12-15 00:45:34 UTC

Fixed in GCC 4.0.

Comment 4 Mark Mitchell 2004-12-15 01:50:56 UTC

Reopening, just for 3.4.

Comment 5 nefercheprure 2005-01-30 15:07:23 UTC

This issue also affects template parameters: see also: 14.1/2, 14.6/5

namespace N { typedef int my_typedef } template < typename N::my_typedef > class X {}; X<3> variable;

Neither the other comments nor the proposed solution mentions this situation. Could you please check this against the proposed solution? In any case the test could be added.

Comment 6 Drea Pinski 2005-01-30 15:10:44 UTC

(In reply to comment #5)

This issue also affects template parameters: see also: 14.1/2, 14.6/5

namespace N { typedef int my_typedef } template < typename N::my_typedef > class X {}; X<3> variable;

Neither the other comments nor the proposed solution mentions this situation. Could you please check this against the proposed solution? In any case the test could be added.

Yes the "proposed" (well it has been committed already on the mainline) works for this test.

Comment 7 Volker Reichelt 2005-09-06 10:41:12 UTC

Taking care of the backport to the 3.4 branch.

Comment 9 Volker Reichelt 2005-09-06 15:27:03 UTC

Fixed also on the 3.4 branch.