]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Avoid ICE with dependent attribute on type.
authorJason Merrill <jason@redhat.com>
Mon, 27 Jan 2020 10:45:01 +0000 (05:45 -0500)
committerJason Merrill <jason@redhat.com>
Tue, 28 Apr 2020 09:56:02 +0000 (05:56 -0400)
commitaa988998be8f85334665a6b049d5d9139408c250
tree63dbf1f0c221efd49ae9290d7a9ea76ee01f6f5e
parent89da6494d784937f20701b13500b296003311491
c++: Avoid ICE with dependent attribute on type.

We previously happened to accept this testcase, but never actually did
anything useful with the attribute.  The patch for PR86379 stopped using
TREE_TYPE as USING_DECL_SCOPE, so 'using A::b' no longer had TREE_TYPE set,
so the language-independent decl_attributes started crashing on it.

GNU attributes are more flexible in their placement than C++11 attributes,
so if we encounter a dependent GNU attribute that syntactically appertains
to a type rather than the declaration as a whole, move it to the
declaration; that's almost certainly what the user meant, anyway.

gcc/cp/ChangeLog
2020-01-27  Jason Merrill  <jason@redhat.com>

PR c++/90750
PR c++/79585
* decl.c (grokdeclarator): Move dependent attribute to decl.
* decl2.c (splice_template_attributes): No longer static.
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/testsuite/g++.dg/ext/attr-type1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wunused-var-26.C