[Bug c++/51027] [C++0x] GCC accepts alias-declaration without ';'
dodji at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Nov 8 16:42:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51027
--- Comment #2 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-11-08 16:38:36 UTC ---
I am currently testing the patchlet below. Sorry for the embarrassing
bug.
From: Dodji Seketeli <dodji@redhat.com>
Date: Tue, 8 Nov 2011 17:21:52 +0100
Subject: [PATCH] PR c++/51027 - accepts alias-declaration without ';'
gcc/cp/
* parser.c (cp_parser_alias_declaration): Require ';' at the end
of declaration.
gcc/testsuite
* g++.dg/cpp0x/alias-decl-12.C: New test.
---
gcc/cp/parser.c | 1 +
gcc/testsuite/g++.dg/cpp0x/alias-decl-12.C | 3 +++
2 files changed, 4 insertions(+), 0 deletions(-)
create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-12.C
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 3d35877..0f2b14b 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -14904,6 +14904,7 @@ cp_parser_alias_declaration (cp_parser* parser)
cp_parser_require (parser, CPP_EQ, RT_EQ);
type = cp_parser_type_id (parser);
+ cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON);
/* A typedef-name can also be introduced by an alias-declaration. The
identifier following the using keyword becomes a typedef-name. It has
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-12.C
b/gcc/testsuite/g++.dg/cpp0x/alias-decl-12.C
new file mode 100644
index 0000000..a8c7260
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-12.C
@@ -0,0 +1,3 @@
+// { dg-options "-std=c++0x" }
+
+using INT = int // { dg-error "expected|;|at end of input" }
--
1.7.6.4
More information about the Gcc-bugs
mailing list