<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/95985>95985</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Most vexing parse with class template disambiguated as function type when it must be an expression that uses CTAD
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          MitalAshok
      </td>
    </tr>
</table>

<pre>
    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
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVcFu4zYQ_ZrxZRBDJi3LOuig2HHRQ4ACDQp3bxQ5ttilSS9JJZt-fTGyU9vZpCjWIGhJFOfNe2-GUinZvSdqoLyHcj1RQ-5DbB5tVq5Nffg66YJ5bfqcjwlkC2IDYrMPpgsuT0Pcg9j8DWIze3zsf1GLroZiDUV7nhfFaWgQ9zzGp5kOR6cygVzl1yN5dSB8AvlwWk05DjrjFqE6v4-IqINPmb4fI25BLJ9A1ON6tT4DVWuQ99fQVyBbkCvrM8gH_IOnM8KXtwifbvw8uz8RZItfxuBiycHFEkTNQz78EPdNhWuYlVN-jzowmPUJc68yy_u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