[clang] [Clang] Profile singly-resolved UnresolvedLookupExpr with the declaration (PR #140029)
Jordan Rupprecht via cfe-commits
cfe-commits at lists.llvm.org
Mon May 19 14:04:25 PDT 2025
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
More information about the cfe-commits
mailing list