https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86243

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |9.0

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Hannes Hauswedell from comment #0)
> This strongly looks like a bug. If one encloses the if-block in braces, I
> instead get a warning:
> 
> int main()
> {
>     if (1 == 2) [[unlikely]]
>     {
>         throw int{};
>     }
> 
>     return 2;
> }
> 
> results in:
> 
> % g++7 -std=c++17 test.cpp
> test.cpp: In function 'int main()':
> test.cpp:3:17: warning: attributes at the beginning of statement are ignored
> [-Wattributes]
>      if (1 == 2) [[unlikely]]
>                  ^

That warning is Bug 89962.

But this bug has been fixed by r266223 and the code is accepted now.

Reply via email to