Issue |
95985
|
Summary |
Most vexing parse with class template disambiguated as function type when it must be an _expression_ that uses CTAD
|
Labels |
new issue
|
Assignees |
|
Reporter |
MitalAshok
|
https://godbolt.org/z/1MMhGa6b9
```c++
template<typename T>
struct X {
constexpr X(T) {}
};
template<X<int> V> struct Z {};
template<typename T>
struct Y : Z<X(int())> {};
```
Clang complains that:
```
<source>:9:14: error: use of class template 'X' requires template arguments; argument deduction not allowed in function return type
9 | struct Y : Z<X(int())> {};
| ^
<source>:2:8: note: template is declared here
2 | struct X {
| ^
```
Because it incorrectly assumes that since `Parser::isCXXDeclarationSpecifier` at `X`, and `(int())` is a valid [*parameters-and-qualifiers*](https://eel.is/c++draft/dcl.decl.general#nt:parameters-and-qualifiers), it must be parsed as a type and not an _expression_.
But there is no ambiguity since `X(int())` cannot be a function type, so https://eel.is/c++draft/dcl.ambig.res doesn't apply and it should be an _expression_.
I think this is the root cause of #95598
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs