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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-01-25
            Summary|Confusing 'goto' is not a   |[C++14/17]Confusing 'goto'
                   |constant expression error   |is not a constant
                   |message in constructor at   |expression error message in
                   |compile time                |constructor at compile time
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
Also the message about goto is after the correct message already too:
```

<source>:3:13: note: 'constexpr MyArr<N>::MyArr(const int (&)[N]) [with int N =
10]' is not usable as a 'constexpr' function because:
    3 |   constexpr MyArr(const int (&arr)[N]) {
      |             ^~~~~
<source>:3:13: error: member 'MyArr<10>::arr_' must be initialized by
mem-initializer in 'constexpr' constructor
<source>:7:7: note: declared here
    7 |   int arr_[N];
      |       ^~~~
```

Interesting clang decides to accepts it (I suspect incorrect because MSVC
rejects it for the same reason as GCC) for C++14 and C++17.

Note for C++20, it is valid and GCC correctly accepts it.

Reply via email to