Issue |
91337
|
Summary |
diagnostic improvement: missing-typename diagnostic
|
Labels |
clang:diagnostics
|
Assignees |
|
Reporter |
hokein
|
Given the following code:
```
template<typename T1>
struct A1 {
template<typename T2>
struct A2 { T2 t; };
};
template <typename K>
void s(K k) {
A1<K>::A2 a(2); // missing a `typename` at head!
}
void s() {
s<double>(1.0);
}
```
Diagnostics emitted by clang are not quite useful, it would be nice to emit a "missing typename" diagnostic (both gcc and msvc do it for this case).
```
<source>:15:13: error: expected ';' after _expression_
15 | A1<K>::A2 a(2); // missing a typenamea at head!
| ^
| ;
<source>:15:14: error: use of undeclared identifier 'a'
15 | A1<K>::A2 a(2); // missing a typename at head!
| ^
<source>:15:11: error: use of class template 'A2' requires template arguments
15 | A1<K>::A2 a(2); // missing a typename at head!
| ^
<source>:19:3: note: in instantiation of function template specialization 's<double>' requested here
19 | s<double>(1.0);
| ^
<source>:10:10: note: template is declared here
9 | template<typename T2>
| ~~~~~~~~~~~~~~~~~~~~~
10 | struct A2 { T2 t; };
| ^
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs