aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-03-26 12:30:41 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-03-26 12:30:41 -0400
commit125c297c69ffe620caa66a9aed3db6287b8f5b33 (patch)
treef2b65bc603ccf55e1ab67954e6ff588c9355b0d6 /gcc
parentddd5c5b7c66a934bb54e4acdddad08a4191d6043 (diff)
downloadgcc-125c297c69ffe620caa66a9aed3db6287b8f5b33.zip
gcc-125c297c69ffe620caa66a9aed3db6287b8f5b33.tar.gz
gcc-125c297c69ffe620caa66a9aed3db6287b8f5b33.tar.bz2
PR c++/85062 - ICE with alignas in wrong place.
* decl.c (grokdeclarator): Ignore attributes on type-specifiers here. From-SVN: r258859
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/decl.c8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alignas16.C9
3 files changed, 17 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 011b24e..34d5101 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2018-03-26 Jason Merrill <jason@redhat.com>
+ PR c++/85062 - ICE with alignas in wrong place.
+ * decl.c (grokdeclarator): Ignore attributes on type-specifiers
+ here.
+
PR c++/85049 - ICE with __integer_pack.
* pt.c (unify_pack_expansion): Don't try to deduce generated packs.
* cp-tree.h (TEMPLATE_PARM_P): New.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 96d4b72..ba45673 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10946,10 +10946,10 @@ grokdeclarator (const cp_declarator *declarator,
if (declspecs->std_attributes)
{
- /* Apply the c++11 attributes to the type preceding them. */
- input_location = declspecs->locations[ds_std_attribute];
- decl_attributes (&type, declspecs->std_attributes, 0);
- input_location = saved_loc;
+ location_t attr_loc = declspecs->locations[ds_std_attribute];
+ if (warning_at (attr_loc, OPT_Wattributes, "attribute ignored"))
+ inform (attr_loc, "an attribute that appertains to a type-specifier "
+ "is ignored");
}
/* Determine the type of the entity declared by recurring on the
diff --git a/gcc/testsuite/g++.dg/cpp0x/alignas16.C b/gcc/testsuite/g++.dg/cpp0x/alignas16.C
new file mode 100644
index 0000000..7c34992
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alignas16.C
@@ -0,0 +1,9 @@
+// PR c++/85062
+// { dg-do compile { target c++11 } }
+
+template<typename... T> struct A
+{
+ int alignas(T...) i; // { dg-warning "ignored" }
+};
+
+A<int> a;