rupprecht wrote:

This PR seems to regress this test case:

```c++
template <typename T>
void f(T&) noexcept;

template <typename T, int N>
void f(T (&arr)[N]) noexcept(noexcept(f(*arr)));

template <typename T>
inline void f(T&) noexcept {}

template <typename T, int N>
inline void f(T (&arr)[N]) noexcept(noexcept(f(*arr))) {}

void g() {
    int x[1];
    f(x);
}
```

gcc at trunk still accepts this, but clang now produces this:

```c++
<source>:11:13: error: exception specification in declaration does not match 
previous declaration
   11 | inline void f(T (&arr)[N]) noexcept(noexcept(f(*arr))) {}
      |             ^
<source>:5:6: note: previous declaration is here
    5 | void f(T (&arr)[N]) noexcept(noexcept(f(*arr)));
      |      ^
```

Live link: https://godbolt.org/z/bdPePGoeh

I don't know if clang is right to reject this, but at face value, the 
diagnostic seems incorrect: the `noexcept` clause in the definition is 
identical to the declaration.

https://github.com/llvm/llvm-project/pull/140029
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to