From: Jason Merrill Date: Mon, 26 Mar 2018 16:30:41 +0000 (-0400) Subject: PR c++/85062 - ICE with alignas in wrong place. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=125c297c69ffe620caa66a9aed3db6287b8f5b33;p=gcc.git PR c++/85062 - ICE with alignas in wrong place. * decl.c (grokdeclarator): Ignore attributes on type-specifiers here. From-SVN: r258859 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 011b24e9068..34d5101963d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2018-03-26 Jason Merrill + 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 96d4b723b4a..ba456737e0e 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 00000000000..7c349929786 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alignas16.C @@ -0,0 +1,9 @@ +// PR c++/85062 +// { dg-do compile { target c++11 } } + +template struct A +{ + int alignas(T...) i; // { dg-warning "ignored" } +}; + +A a;