Issue |
151156
|
Summary |
[Clang] Fails to diagnose `return;` in non-void function in class template
|
Labels |
clang
|
Assignees |
|
Reporter |
Xniao
|
## Program
```cpp
template <class T> struct S {
T f;
S() : f() {}
S foo() {
return;
}
};
int main() {
S<int> f,g;
}
```
Repro: https://godbolt.org/z/cf7oTvqfa
✅ GCC correctly rejects with a diagnostic.
❌ Clang accepts, unless the function is called.
When the return type of function `foo` is changed from `S` to `int`, Clang does reject the code.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs