| Issue |
164398
|
| Summary |
[clang] Clang accepts explicit instantiation of a function template with deduced return type and explicit trailing return type (non‑standard)
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
Attacker23
|
I suspect that **Clang currently accepts a non‑standard form of explicit instantiation** that other major compilers (GCC, MSVC, EDG) correctly reject:
```cpp
struct A {
char g() { return 'a'; }
template<class T> auto f(T t) {
return t + g();
}
};
template auto A::f<int>(int t) -> decltype(t + g());
// The correct code should probably be:
// template auto A::f<int>(int t);
```
What’s puzzling is the version history:
- **Clang ≤ 16.0.0** correctly rejected this code.
- **Clang 17.0.1 – 18.1.0** caused a **crash**.
- **Clang 19.1.0+** now **accepts** the code silently.
It would be helpful to know **which change or patch introduced this behavior**,
and whether the current acceptance is intentional or a missing diagnostic.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs