Commit 771ce78e by Simon Baldwin Committed by Simon Baldwin

re PR c++/36999 (Erroneous "declaration 'class ...' does not declare anything" warnings possible)

        PR c++/36999
        * parser.c (cp_parser_elaborated_type_specifier): Warn only when
        the declaration's id is followed by a semicolon.

	* g++.dg/warn/pr36999.C: New.

From-SVN: r138633
parent 6fc3c2b2
2008-08-04 Simon Baldwin <simonb@google.com>
PR c++/36999
* parser.c (cp_parser_elaborated_type_specifier): Warn only when
the declaration's id is followed by a semicolon.
2008-07-31 Jakub Jelinek <jakub@redhat.com>
PR c++/36405
......
......@@ -11516,7 +11516,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
caught elsewhere in parsing. Those that are pointless arrive
here. */
if (cp_parser_declares_only_class_p (parser)
if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)
&& !is_friend && !processing_explicit_instantiation)
warning (0, "declaration %qD does not declare anything", decl);
......
2008-08-04 Simon Baldwin <simonb@google.com>
PR c++/36999
* g++.dg/warn/pr36999.C: New.
2008-08-04 Arnaud Charlet <charlet@adacore.com>
* gnat.dg/bip_aggregate_bug.adb: New test.
......
/* PR36999: Erroneous "does not declare anything" warnings. */
/* { dg-do compile } */
class C1 {
public: class C2 { };
};
void cf1 (class C1::C2, void*); // { dg-bogus "does not declare anything" }
void cf2 (void*, class C1::C2);
void cf3 (C1::C2, void*);
namespace N {
enum E1 { foo };
enum E2 { bar };
template <class X>
class TC1 { };
template <class T, class U>
class TC2 : public TC1<T> { };
}
void
tcf1 (N::TC2<enum N::E1, void*> *arg1, // { dg-bogus "does not declare anything" }
N::TC2<void*, enum N::E1> *arg2,
N::TC2<N::E1, void*> *arg3)
{
}
void *
tcf2 (void *x)
{
return (void *)
(N::TC2<enum N::E1, void*> *) // { dg-bogus "does not declare anything" }
(N::TC2<void*, enum N::E1> *)
(N::TC2<N::E1, void*> *)
x;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment