[Bug c++/38501] typedef confuses the name of the template and the name of result
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Dec 12 01:49:00 GMT 2008
------- Comment #2 from pinskia at gcc dot gnu dot org 2008-12-12 01:46 -------
No GCC 4.3 and above is doing the correct thing. This code is invalid but no
diagnostic is required by the C++ standard.
See <http://gcc.gnu.org/gcc-4.3/porting_to.html>:
Name lookup changes
GCC by default no longer accepts code such as
template <class _Tp> class auto_ptr {};
template <class _Tp>
struct counted_ptr
{
auto_ptr<_Tp> auto_ptr();
};
but will issue the diagnostic
error: declaration of 'auto_ptr<_Tp> counted_ptr<_Tp>::auto_ptr()'
error: changes meaning of 'auto_ptr' from 'class auto_ptr<_Tp>'
The reference to struct auto_ptr needs to be qualified here, or the name of the
member function changed to be unambiguous.
template <class _Tp> class auto_ptr {};
template <class _Tp>
struct counted_ptr
{
::auto_ptr<_Tp> auto_ptr();
};
In addition, -fpermissive can be used as a temporary workaround to convert the
error into a warning until the code is fixed. Note that then in some case name
lookup will not be standard conforming.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38501
More information about the Gcc-bugs
mailing list