llvm / llvm/llvm-project

Expansion statements fail to diagnose extern function decls with mismatching exception specifiers

Open
#211,932 7 comments 0 reactions 0 assignees View on GitHub
clang:frontend
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

We should be diagnosing local extern function declarations with mismatching exception specifiers in expansion statements, but alas we are not.

Neither clang nor gcc get this right:

https://compiler-explorer.com/z/4K8sxzz47

```cpp
int noexcept_decl() noexcept(true);

void foo1() {
extern int noexcept_decl() noexcept(false); // diagnosed
}

void foo2() {
template for (constexpr auto x : {1}) {
extern int noexcept_decl() noexcept(false); // not diagnosed
}
}

void foo3() {
template for (constexpr auto x : {true, false}) {
extern int noexcept_decl() noexcept(x); // not diagnosed
}
}

```

@Sirraide \o/

Not fixed by #211745

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the three cases from the issue, comparing the ordinary local extern declaration with the expansion-statement cases and checking the current diagnostic behavior. Trace the compiler path handling local extern declarations and expansion statements; done means mismatching exception specifiers are diagnosed in all three examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.