diff options
author | Simon Baldwin <simonb@google.com> | 2007-07-02 17:57:57 +0000 |
---|---|---|
committer | Simon Baldwin <simonb@gcc.gnu.org> | 2007-07-02 17:57:57 +0000 |
commit | 2a7b8343cb0372cc52db8b625297336130280b4e (patch) | |
tree | 3a99335dd999003cb987b005ffaed594727657ea /gcc/cp/parser.c | |
parent | d49343266bbe24e86d772f2cf1513012e1fae90c (diff) | |
download | gcc-2a7b8343cb0372cc52db8b625297336130280b4e.zip gcc-2a7b8343cb0372cc52db8b625297336130280b4e.tar.gz gcc-2a7b8343cb0372cc52db8b625297336130280b4e.tar.bz2 |
parser.c (cp_parser_elaborated_type_specifier): Added a warning for inner-style nested forward declarations that don't declare...
2007-07-02 Simon Baldwin <simonb@google.com>
* parser.c (cp_parser_elaborated_type_specifier): Added a warning
for inner-style nested forward declarations that don't declare
anything useful.
From-SVN: r126219
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 484c6b5..d6e6204 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -10913,6 +10913,23 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, return error_mark_node; } + /* Forward declarations of nested types, such as + + class C1::C2; + class C1::C2::C3; + + are invalid unless all components preceding the final '::' + are complete. If all enclosing types are complete, these + declarations become merely pointless. + + Invalid forward declarations of nested types are errors + caught elsewhere in parsing. Those that are pointless arrive + here. */ + + if (cp_parser_declares_only_class_p (parser) + && !is_friend && !processing_explicit_instantiation) + warning (0, "declaration %qD does not declare anything", decl); + type = TREE_TYPE (decl); } else |