This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/52906 (ICE with attribute by itself)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 11 Apr 2012 19:58:54 +0200
- Subject: Re: C++ PATCH for c++/52906 (ICE with attribute by itself)
- References: <4F85C409.6080305@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Apr 11, 2012 at 01:48:57PM -0400, Jason Merrill wrote:
> We can't talk about the type if there is no type.
>
> Tested x86_64-pc-linux-gnu, applying to trunk.
Shouldn't this go to 4.7 too?
> commit bc94f519583cdfc705c1bde750a06bbd42537193
> Author: Jason Merrill <jason@redhat.com>
> Date: Wed Apr 11 10:08:37 2012 -0400
>
> PR c++/52906
> * decl.c (check_tag_decl): Don't complain about attributes if we
> don't even have a type.
>
> diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
> index e2f01d5..8b22192 100644
> --- a/gcc/cp/decl.c
> +++ b/gcc/cp/decl.c
> @@ -4224,7 +4224,7 @@ check_tag_decl (cp_decl_specifier_seq *declspecs)
> error ("%<constexpr%> cannot be used for type declarations");
> }
>
> - if (declspecs->attributes && warn_attributes)
> + if (declspecs->attributes && warn_attributes && declared_type)
> {
> location_t loc;
> if (!CLASS_TYPE_P (declared_type)
> diff --git a/gcc/testsuite/g++.dg/ext/attrib45.C b/gcc/testsuite/g++.dg/ext/attrib45.C
> new file mode 100644
> index 0000000..0be1322
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/ext/attrib45.C
> @@ -0,0 +1,3 @@
> +// PR c++/52906
> +
> +__attribute__ ((__deprecated__)); // { dg-error "does not declare anything" }
Jakub