https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86243
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2018-07-02 CC| |msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed. GCC recognizes an attribute when it applies to other statements but gets confused when it's applied to a throw expression statement as in comment #0. $ cat t.C && gcc -S t.C int f () { [[unlikely]] return 0; [[unlikely]] { } [[unlikely]] throw 0; } t.C: In function ‘int f()’: t.C:3:3: warning: attributes at the beginning of statement are ignored [-Wattributes] [[unlikely]] return 0; ^ t.C:4:3: warning: attributes at the beginning of statement are ignored [-Wattributes] [[unlikely]] { } ^ t.C:6:4: error: expected identifier before ‘[’ token [[unlikely]] throw 0; ^ t.C: In lambda function: t.C:6:16: error: expected ‘{’ before ‘throw’ [[unlikely]] throw 0; ^~~~~ t.C: In function ‘int f()’: t.C:6:15: error: expected ‘;’ before ‘throw’ [[unlikely]] throw 0; ^~~~~~ ;