[Bug c++/96078] New: [10/11 Regression] flatten attribute on constructor and destructor causes spurious warning
rs2740 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jul 6 13:15:58 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96078
Bug ID: 96078
Summary: [10/11 Regression] flatten attribute on constructor
and destructor causes spurious warning
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: rs2740 at gmail dot com
Target Milestone: ---
struct A {
[[gnu::flatten]] A() {}
[[gnu::flatten]] ~A() {}
};
A a;
Produces no warnings with GCC 9 but on GCC 10 and trunk warns:
<source>:3:22: warning: 'flatten' attribute is ignored on aliases
[-Wattributes]
3 | [[gnu::flatten]] ~A() {}
| ^
<source>:2:22: warning: 'flatten' attribute is ignored on aliases
[-Wattributes]
2 | [[gnu::flatten]] A() {}
| ^
The warning appears to be introduced by the fix to PR92372.
Marking `A` as `final` eliminates the warnings, as does giving it an virtual
base class. Presumably the issue is that in the problematic case one of the
complete/base object c/dtors was treated as an alias for the other?
More information about the Gcc-bugs
mailing list