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

    <tr>
        <th>Summary</th>
        <td>
            [clang] clang trunk crashed at clang::Sema::DefaultArgumentPromotion(clang::Expr*)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend,
            crash-on-invalid,
            regression:16,
            clang:frontend:fuzzer
      </td>
    </tr>

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

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

<pre>
    **This testcase is generated by a fuzzer.**

Compiler Explorer: [https://godbolt.org/z/36nhWEY5v](https://godbolt.org/z/36nhWEY5v)

This invalid code will crash on Clang Trunk.
```cpp
template<typename T> struct A {
  template<typename U> struct B {
    B(...);
    B(const B & = ;) = default;
  };
  template<typename U> B(U) -> B<U>;
};
A<void>::B b = 123;
A<void>::B copy = b;
```

This goes back to clang-16. The stack dump seems to be similar with [102106](https://github.com/llvm/llvm-project/issues/102106) and [27228](https://github.com/llvm/llvm-project/issues/27228) and I believe that these two are the same issue.

Stack dump:
```
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: /opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir /app/output.s- -disable-free -clear-ast-before-backend -main-file-name example.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -fno-verbose-asm -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fdebug-compilation-dir=/app -fcoverage-compilation-dir=/app -resource-dir /opt/compiler-explorer/clang-assertions-trunk-20241024/lib/clang/20 -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0 -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0/x86_64-linux-gnu -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0/backward -internal-isystem /opt/compiler-explorer/clang-assertions-trunk-20241024/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.0/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/example-cb2afb.o -x c++ <source>
1.      <source>:9:20: current parser token ';'
  #0 0x0000000003bd1a88 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x3bd1a88)
 #1 0x0000000003bcf43c SignalHandler(int) Signals.cpp:0:0
  #2 0x00007b0ff7842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
  #3 0x0000000006efc3cb clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&, clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6efc3cb)
 #4 0x0000000006ca3bf8 clang::Sema::DefaultArgumentPromotion(clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6ca3bf8)
 #5 0x0000000006cb36b8 clang::Sema::DefaultVariadicArgumentPromotion(clang::Expr*, clang::Sema::VariadicCallType, clang::FunctionDecl*) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6cb36b8)
 #6 0x0000000006cb43e2 clang::Sema::GatherArgumentsForCall(clang::SourceLocation, clang::FunctionDecl*, clang::FunctionProtoType const*, unsigned int, llvm::ArrayRef<clang::Expr*>, llvm::SmallVectorImpl<clang::Expr*>&, clang::Sema::VariadicCallType, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6cb43e2)
 #7 0x0000000006aec996 clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*, clang::QualType, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, llvm::SmallVectorImpl<clang::Expr*>&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6aec996)
 #8 0x0000000006edfcb9 PerformConstructorInitialization(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::InitializationSequence::Step const&, bool&, bool, bool, clang::SourceLocation, clang::SourceLocation) SemaInit.cpp:0:0
  #9 0x0000000006eeed2a clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6eeed2a)
 #10 0x0000000006efc472 clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&, clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6efc472)
 #11 0x0000000006ca3bf8 clang::Sema::DefaultArgumentPromotion(clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6ca3bf8)
 #12 0x0000000006cb36b8 clang::Sema::DefaultVariadicArgumentPromotion(clang::Expr*, clang::Sema::VariadicCallType, clang::FunctionDecl*) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6cb36b8)
 #13 0x0000000006cb43e2 clang::Sema::GatherArgumentsForCall(clang::SourceLocation, clang::FunctionDecl*, clang::FunctionProtoType const*, unsigned int, llvm::ArrayRef<clang::Expr*>, llvm::SmallVectorImpl<clang::Expr*>&, clang::Sema::VariadicCallType, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6cb43e2)
 #14 0x0000000006aec996 clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*, clang::QualType, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, llvm::SmallVectorImpl<clang::Expr*>&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6aec996)
 #15 0x0000000006edfcb9 PerformConstructorInitialization(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::InitializationSequence::Step const&, bool&, bool, bool, clang::SourceLocation, clang::SourceLocation) SemaInit.cpp:0:0
 #16 0x0000000006eeed2a clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6eeed2a)
 #17 0x0000000006efc472 clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&, clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6efc472)
 #18 0x0000000006ca3bf8 clang::Sema::DefaultArgumentPromotion(clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6ca3bf8)
 #19 0x0000000006cb36b8 clang::Sema::DefaultVariadicArgumentPromotion(clang::Expr*, clang::Sema::VariadicCallType, clang::FunctionDecl*) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6cb36b8)
 #20 0x0000000006cb43e2 clang::Sema::GatherArgumentsForCall(clang::SourceLocation, clang::FunctionDecl*, clang::FunctionProtoType const*, unsigned int, llvm::ArrayRef<clang::Expr*>, llvm::SmallVectorImpl<clang::Expr*>&, clang::Sema::VariadicCallType, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6cb43e2)
 #21 0x0000000006aec996 clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*, clang::QualType, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, llvm::SmallVectorImpl<clang::Expr*>&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20241024/bin/clang-20+0x6aec996)
 #22 0x0000000006edfcb9 PerformConstructorInitialization(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::InitializationSequence::Step const&, bool&, bool, bool, clang::SourceLocation, clang::SourceLocation) SemaInit.cpp:0:0

... (loop)

clang++: error: unable to execute command: Segmentation fault (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
Execution build compiler returned: 254
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWl9z2zYS_zT0yw44JChR4oMfZMlqM9fO5Or0zz15QHBJoQYBHgDacj79DUBa_6z40qZJmo4zjiwBi8Xubxe7P1pg1opGIV5G06tourpgvdtoc_kofmdqMp9ML0pdPV5GdBHRxbuNsODQOs4sgrDQoELDHFZQPgKDun__Hk08CEfJKkrG16VuOyHRwPW2k9qgibIFRNOrjXOdjbJFRNcRXTe6KrV0sTZNRNfvI7rOcrX59fo_0_touoro_OPFaXG4fbBbqHsmRQVcVwgPQkrghtkNaAVLyVQD70yv7uJxXZ4MP7zrhhGHbSeZwyhbuscOFWsR3kXZNVhneu5gAdHsahAFOCf884Hw1aEwwFVE53Ece6uzk2GulQ3yNIcoW4EXoEV4W2HNeukOlkSz1cGnDxrh9f7stZDhU7b0w7uVh1oWUba816IK84soW1xBGTZPafaSENfdY5Ar92qfIH0WmUajhZLxO3AauI8FSfMY3m0QrPPDVd92YBFb6yVKBCtaIZmBB-E2Po_ShKZJfjZJhNv0Zcx1G9G1l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