llvm / llvm/llvm-project

Template matching incorrectly considers __attribute__((noreturn))?

Open
#207,517 11 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

```c++
#include

template
struct S;

template
struct S {};

template
struct S {};

static_assert(sizeof(S) != 0);
```

produces

```
:12:15: error: implicit instantiation of undefined template 'S'
12 | static_assert(sizeof(S) != 0);
| ^
:4:8: note: template is declared here
4 | struct S;
| ^
```

on Clang, but GCC only produces a warning:

```
:12:39: warning: ignoring attributes on template argument 'void() noexcept' [-Wignored-attributes]
12 | static_assert(sizeof(S) != 0);
| ^
```

Contributor guide

Open the contributing guide

Research direction

The issue names no source files or tests; begin by compiling the provided C++ reproducer with Clang and GCC. Trace how Clang matches the two S specializations for decltype(abort), including noreturn and noexcept handling. Done requires an agreed expected result, corrected behavior, and regression coverage in the relevant compiler tests.

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
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.