http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57374
Bug ID: 57374 Summary: c+11 attribute noreturn does not blend well Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: akim.demaille at gmail dot com Hi! I meant to use [[noreturn]] instead of __attribute__((noreturn)) (as it is my understanding from reading http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53528 that it was meant to be so (but maybe not yet implemented). FWIW, support for [[noreturn]] in 4.8 and 4.9 seems incomplete. $ cat /tmp/foo.cc void die() [[noreturn]]; void die() { throw 1; } void and_again() [[noreturn]] { throw 2; } void please_die() [[gnu::noreturn]] { throw 3; } $ g++-mp-4.8 -Wall -Wsuggest-attribute=noreturn -c -std=c++11 /tmp/foo.cc /tmp/foo.cc:1:23: warning: 'noreturn' attribute directive ignored [-Wattributes] void die() [[noreturn]]; ^ /tmp/foo.cc:4:29: warning: 'noreturn' attribute directive ignored [-Wattributes] void and_again() [[noreturn]] { throw 2; } ^ /tmp/foo.cc:6:35: warning: attribute ignored [-Wattributes] void please_die() [[gnu::noreturn]] { throw 3; } ^ /tmp/foo.cc:6:35: note: an attribute that appertains to a type-specifier is ignored /tmp/foo.cc: In function 'void die()': /tmp/foo.cc:2:6: warning: function might be candidate for attribute 'noreturn' [-Wsuggest-attribute=noreturn] void die() { throw 1; } ^ /tmp/foo.cc: In function 'void and_again()': /tmp/foo.cc:4:6: warning: function might be candidate for attribute 'noreturn' [-Wsuggest-attribute=noreturn] void and_again() [[noreturn]] { throw 2; } ^ /tmp/foo.cc: In function 'void please_die()': /tmp/foo.cc:6:6: warning: function might be candidate for attribute 'noreturn' [-Wsuggest-attribute=noreturn] void please_die() [[gnu::noreturn]] { throw 3; } ^ $ Using __attribute__, things work as expected.