c++/708
Martin Sebor
sebor@roguewave.com
Mon Feb 19 15:26:00 GMT 2001
mmitchel@gcc.gnu.org wrote:
>
> The following reply was made to PR c++/708; it has been noted by GNATS.
>
> From: mmitchel@gcc.gnu.org
> To: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org, sebor@roguewave.com
> Cc:
> Subject: Re: c++/708
> Date: 19 Feb 2001 21:53:17 -0000
>
> Synopsis: useless warning for legal code
>
> State-Changed-From-To: analyzed->closed
> State-Changed-By: mmitchel
> State-Changed-When: Mon Feb 19 13:53:17 2001
> State-Changed-Why:
> Not a bug.
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=708&database=gcc
I'm having trouble coming up with a legitimate use case where the warning could
be helpful (perhaps you have one?). We have run into it in three distinct places
in three of our products. In each case the warning was simply pointing out what
was known to and intended by the author of the code, not a code problem.
Other than gcc, none of the 10 compilers that I work with warns about the
construct, even at strict warning and conformance setting. As I said in the
report, I believe that it is wrong for a compiler to issue a diagnostic for a
correct language construct. Commercial conformance test suites will fail a
compiler for doing so.
The warning is also inconsistent, and disappears when B<T>::V doesn't depend on
T, which further diminishes its usefulness:
template <class T>
struct A
{
typedef T V;
};
template <class T>
struct B
{
// typedef typename T::V V; // warning
typedef T V; // no warning
struct C: A<V> {
typedef A<V> X;
};
};
Regards
Martin
More information about the Gcc-bugs
mailing list