This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/8753: Wishlist: g++ disable Warning "is implicitly a typename"
- From: Steffen Neumann <sneumann at TechFak dot Uni-Bielefeld dot DE>
- To: gcc-gnats at gcc dot gnu dot org
- Date: Fri, 29 Nov 2002 14:12:28 +0100 (MET)
- Subject: c++/8753: Wishlist: g++ disable Warning "is implicitly a typename"
- Reply-to: sneumann at TechFak dot Uni-Bielefeld dot DE
>Number: 8753
>Category: c++
>Synopsis: Wishlist: g++ disable Warning "is implicitly a typename"
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Fri Nov 29 05:16:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:
>Release: 3.1
>Organization:
Uni Bielefeld, Technical Faculty
>Environment:
System: OSF1 liszt V4.0 1229 alpha
Machine: alpha
host: alpha-dec-osf4.0f
build: alpha-dec-osf4.0f
target: alpha-dec-osf4.0f
configured with: /vol/gnu/src/gcc/gcc-3.1-branch-dist/configure --prefix=/vol/gnu --with-local-prefix=/vol/gnu --disable-nls alpha-dec-osf4.0f
>Description:
The C++ Standard requires that typedef'ed
template types be marked with 'typename ...'.
Old Code therefore emits tons of warnings for which
no -Wno-implicit-... switch exists.
If it doesn't clash with some gcc policy,
I'd like to ask for an '-Wno-implicit-typename'
switch or similar, at least as long as the
<quote gcc.info> Deprecated Feature - "implicit typename extension"
is not removed from g++ code </quote>
>How-To-Repeat:
The following code generates
warnings for the typedef'ed buf_t,
with 'implicit typename is deprecated'-Warnings disabled:
g++ -Wno-deprecated s.C
---------------------
// Code taken from Marcel Loose (loose@astron.nl)
// Posting in gnu.g++.help on 10 Sep 2002
#include <vector>
template <class T>
class Buffer
{
private:
typedef std::vector<T> buf_t;
class Index
{
public:
explicit Index( buf_t::size_type size = 1 );
operator buf_t::size_type() const;
private:
buf_t::size_type myIndex;
buf_t::size_type mySize;
};
buf_t buf;
public:
explicit Buffer( buf_t::size_type size = 1 );
};
template <class T>
Buffer<T>::Index::Index( buf_t::size_type size ) :
myIndex( 0 ), mySize( size )
{
}
template <class T>
Buffer<T>::Index::operator Buffer<T>::buf_t::size_type() const
{
return myIndex;
}
template <class T>
Buffer<T>::Buffer( buf_t::size_type size ) :
buf(size)
{
}
int main()
{
Buffer<int> buf(10);
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: