From bd0424fa93a378febead635136ad219f9d34b2b7 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Wed, 9 Nov 2011 08:00:58 +0000 Subject: [PATCH] PR c++/51027 - accepts alias-declaration without ';' gcc/cp/ * parser.c (cp_parser_alias_declaration): Require ';' at the end of the declaration. libstdc++-v3/ * include/ext/pointer.h (rebind): Append missing ';'. gcc/testsuite * g++.dg/cpp0x/alias-decl-12.C: New test. * g++.dg/ext/alias-decl-attr4.C: Append missing ';'. From-SVN: r181195 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 1 + gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/cpp0x/alias-decl-12.C | 4 ++++ gcc/testsuite/g++.dg/ext/alias-decl-attr4.C | 2 +- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/include/ext/pointer.h | 2 +- 7 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-12.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6445befedd33..f7f91d2cd458 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-11-09 Dodji Seketeli + + PR c++/51027 + * parser.c (cp_parser_alias_declaration): Require ';' at the end + of the declaration. + 2011-11-09 Dodji Seketeli PR debug/51032 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index fde4c6d838f8..1376a3af0bdc 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -14942,6 +14942,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/ChangeLog b/gcc/testsuite/ChangeLog index 4abcf0784a4f..7b59aeba3593 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-11-09 Dodji Seketeli + + PR c++/51027 + * g++.dg/cpp0x/alias-decl-12.C: New test. + * g++.dg/ext/alias-decl-attr4.C: Append missing ';'. + 2011-11-09 Dodji Seketeli PR debug/51032 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 000000000000..11c26865d9e8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-12.C @@ -0,0 +1,4 @@ +// Origin: PR c++/51027 +// { dg-options "-std=c++0x" } + +using INT = int // { dg-error "expected|;|at end of input" } diff --git a/gcc/testsuite/g++.dg/ext/alias-decl-attr4.C b/gcc/testsuite/g++.dg/ext/alias-decl-attr4.C index c4dd04877896..3e1c1c405db0 100644 --- a/gcc/testsuite/g++.dg/ext/alias-decl-attr4.C +++ b/gcc/testsuite/g++.dg/ext/alias-decl-attr4.C @@ -11,7 +11,7 @@ template struct A template < typename Val > struct S { using vector_type __attribute__((vector_size(16))) = - typename A::type + typename A::type; typedef Val vector_type2 __attribute__((vector_size(16))); int pr_size() { return sizeof(vector_type); } int pr_size2() { return sizeof(vector_type2); } diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b8b6e358dce7..4d4608e36251 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2011-11-09 Dodji Seketeli + + PR c++/51027 + * include/ext/pointer.h (rebind): Append missing ';'. + 2011-11-09 Jonathan Wakely * include/bits/stl_vector.h (vector::_Alloc_traits): Make private. diff --git a/libstdc++-v3/include/ext/pointer.h b/libstdc++-v3/include/ext/pointer.h index 45fed19993ed..8b33740f25b9 100644 --- a/libstdc++-v3/include/ext/pointer.h +++ b/libstdc++-v3/include/ext/pointer.h @@ -579,7 +579,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template using rebind = typename __gnu_cxx::_Pointer_adapter< - typename pointer_traits<_Storage_policy>::rebind<_Up>> + typename pointer_traits<_Storage_policy>::rebind<_Up>>; static pointer pointer_to(typename pointer::reference __r) noexcept { return pointer(std::addressof(__r)); } -- 2.47.2