[clang] [clang][Sema] Improve error recovery for id-expressions referencing invalid decls (PR #81662)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 25 20:46:11 PDT 2024
HighCommander4 wrote:
Here is a reduced testcase for the OpenMP test failure:
```c++
#pragma omp declare target
static long double ld_return1e() { return 0; }
void external() {
void *p1 = reinterpret_cast<void*>(&ld_return1e);
}
#pragma omp end declare target
```
When built with the following command:
> clang -cc1 -fopenmp -triple nvptx64-unknown-unknown -aux-triple x86_64-unknown-linux test.cpp -fopenmp-is-target-device -fsyntax-only
Here are the diagnostics before this patch:
```console
test.cpp:6:39: error: 'ld_return1e' requires 128 bit size 'long double' type support, but target 'nvptx64-unknown-unknown' does not support it
6 | void *p1 = reinterpret_cast<void*>(&ld_return1e);
| ^
test.cpp:3:20: note: 'ld_return1e' defined here
3 | static long double ld_return1e() { return 0; }
| ^
1 error generated
```
and here are the diagnostics after this patch:
```console
test.cpp:6:39: error: 'ld_return1e' requires 128 bit size 'long double' type support, but target 'nvptx64-unknown-unknown' does not support it
6 | void *p1 = reinterpret_cast<void*>(&ld_return1e);
| ^
test.cpp:3:20: note: 'ld_return1e' defined here
3 | static long double ld_return1e() { return 0; }
| ^
test.cpp:3:20: error: 'ld_return1e' requires 128 bit size 'long double' type support, but target 'nvptx64-unknown-unknown' does not support it
3 | static long double ld_return1e() { return 0; }
| ^
test.cpp:6:39: note: called by 'external'
6 | void *p1 = reinterpret_cast<void*>(&ld_return1e);
| ^
test.cpp:3:20: note: 'ld_return1e' defined here
3 | static long double ld_return1e() { return 0; }
| ^
2 errors generated.
```
Basically, the patch somehow causes the same diagnostic to be issued a second time at a different location.
https://github.com/llvm/llvm-project/pull/81662
More information about the cfe-commits
mailing list