https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81675
Bug ID: 81675
Summary: attribute(noreturn) of destructor in :? not honored
Product: gcc
Version: 6.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
cat > t.cc << EOF
struct S
{
~S() __attribute__((noreturn));
int a;
};
int foo()
{
false ? 5 : S().a;
}
EOF
g++ -c -Wall t.cc
GCC 6.2.0 prints:
t.cc: In function 'int foo()':
t.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type]
GCC 5.3.0 seems to detect correctly that foo() will never return.