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

    <tr>
        <th>Summary</th>
        <td>
            Clang crashes at deducing auto type.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    Reproducer:
```c++
template <auto T> struct A {};
template <auto T> A<*T> operator *() { return {}; }
```
Output:
```
clang: /llvm/clang/lib/AST/ExprClassification.cpp:57: Cl clang::Expr::ClassifyImpl(clang::ASTContext&, clang::SourceLocation*) const: Assertion `isLValue()' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: build-main/bin/clang -fsyntax-only /tmp/clang-crash.cpp
1.      /tmp/clang-crash.cpp:2:36: at annotation token
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libLLVMSupport.so.18git       0x000014755e946f90 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 240
1 libLLVMSupport.so.18git       0x000014755e94439f llvm::sys::RunSignalHandlers() + 47
2  libLLVMSupport.so.18git 0x000014755e8492e8
3  libc.so.6 0x000014755e349520
4  libc.so.6                     0x000014755e39da7c pthread_kill + 300
5  libc.so.6                     0x000014755e349476 raise + 22
6  libc.so.6                     0x000014755e32f7f3 abort + 211
7  libc.so.6                     0x000014755e32f71b
8  libc.so.6 0x000014755e340e96
9  libclangAST.so.18git 0x000014755c85b3e3 clang::Expr::ClassifyImpl(clang::ASTContext&, clang::SourceLocation*) const + 1219
10 libclangSema.so.18git 0x000014755b794534 clang::Sema::DeduceAutoType(clang::TypeLoc, clang::Expr*, clang::QualType&, clang::sema::TemplateDeductionInfo&, bool, bool, clang::TemplateSpecCandidateSet*) + 2804
11 libclangSema.so.18git 0x000014755b691fed clang::Sema::CheckTemplateArgument(clang::NonTypeTemplateParmDecl*, clang::QualType, clang::Expr*, clang::TemplateArgument&, clang::TemplateArgument&, clang::Sema::CheckTemplateArgumentKind) + 1181
12 libclangSema.so.18git         0x000014755b69499d clang::Sema::CheckTemplateArgument(clang::NamedDecl*, clang::TemplateArgumentLoc&, clang::NamedDecl*, clang::SourceLocation, clang::SourceLocation, unsigned int, llvm::SmallVectorImpl<clang::TemplateArgument>&, llvm::SmallVectorImpl<clang::TemplateArgument>&, clang::Sema::CheckTemplateArgumentKind) + 1485
13 libclangSema.so.18git 0x000014755b6984e7 clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo&, bool, llvm::SmallVectorImpl<clang::TemplateArgument>&, llvm::SmallVectorImpl<clang::TemplateArgument>&, bool, bool*) + 823
14 libclangSema.so.18git         0x000014755b6a16b8 clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&) + 808
15 libclangSema.so.18git 0x000014755b6a3a4a clang::Sema::ActOnTemplateIdType(clang::Scope*, clang::CXXScopeSpec&, clang::SourceLocation, clang::OpaquePtr<clang::TemplateName>, clang::IdentifierInfo*, clang::SourceLocation, clang::SourceLocation, llvm::MutableArrayRef<clang::ParsedTemplateArgument>, clang::SourceLocation, bool, bool, clang::ImplicitTypenameContext) + 1338
16 libclangParse.so.18git        0x000014755bd510f5 clang::Parser::AnnotateTemplateIdTokenAsType(clang::CXXScopeSpec&, clang::ImplicitTypenameContext, bool) + 309
17 libclangParse.so.18git 0x000014755bc8aad8 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) + 5000
18 libclangParse.so.18git 0x000014755bd52313 clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) + 979
19 libclangParse.so.18git        0x000014755bd601c7
20 libclangParse.so.18git        0x000014755bd604a6 clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) + 214
21 libclangParse.so.18git        0x000014755bc9926d clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) + 621
22 libclangParse.so.18git 0x000014755bd7817a clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) + 1082
23 libclangParse.so.18git        0x000014755bd790b5 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) + 693
24 libclangParse.so.18git 0x000014755bc66b5a clang::ParseAST(clang::Sema&, bool, bool) + 570
25 libclangFrontend.so.18git     0x00001475610e5279 clang::FrontendAction::Execute() + 201
26 libclangFrontend.so.18git 0x0000147561056315 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 405
27 libclangFrontendTool.so.18git 0x0000147562cc5145 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 421
28 clang 0x00005585bd0682b9 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 6409
29 clang 0x00005585bd0602e3
30 libclangDriver.so.18git 0x0000147560d34f6d
31 libLLVMSupport.so.18git       0x000014755e8497b0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 160
32 libclangDriver.so.18git       0x0000147560d357ee
33 libclangDriver.so.18git       0x0000147560cf605a clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const + 170
34 libclangDriver.so.18git       0x0000147560cf6b2d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const + 253
35 libclangDriver.so.18git       0x0000147560d05ac4 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) + 404
36 clang                         0x00005585bd0657d0 clang_main(int, char**, llvm::ToolContext const&) + 9568
37 clang 0x00005585bd05eee3 main + 51
38 libc.so.6 0x000014755e330d90
39 libc.so.6                     0x000014755e330e40 __libc_start_main + 128
40 clang 0x00005585bd05ef25 _start + 37
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 18.0.0 (https://github.com/intel/llvm.git af4751738db89a142a8880c782d12d4201b222a8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /llvm/build-main/bin
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/clang-crash-ff0ae6.cpp
clang: note: diagnostic msg: /tmp/clang-crash-ff0ae6.sh
clang: note: diagnostic msg: 

********************
```

The issue is reproducible with the clang built with enabled assertions. I wasn't able to reproduce it with clang-17.

git bisect says that the issue is introduced by af4751738db89a142a8880c782d12d4201b222a8.
@cor3ntin, could you take a look at this, please?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEWl1z6jjS_jXOjSqULX9f5MKHhDmZN2eSN7Azs3uTkq0GtDGSV5Jzwv76LckyYAIE5szOpqhgbLW6--kPtdQmSrEFB7jx4i9efHtFWr0U8qYkFORVKej65hkaKWhbgfTCwvNvPb_wEr_7VB7-Yj72roZVUxMNyAvHpNUCzbzwDikt20qjAnnpFy-99cKTowsvHHu4sNeiAUm0kMjDhYczD-dmDiRBt5Jvp0PmayhW9_Ox1U2rPwrd_axqwhdeWCAPT-r6beXhSXcLT2pWenhSTGcenty9N3JcG5TmrCKaCT6qmsYLizg1xOMa9RN5YWEGd1eO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