<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [clang] After 7d2d5a3a6d7, Assertion failed: (getContext().hasSameUnqualifiedType(E->getType(), E->getArg(0)->getType())), function EmitCXXConstructExpr, file clang/lib/CodeGen/CGExprCXX.cpp, line 616"
   href="https://bugs.llvm.org/show_bug.cgi?id=51862">51862</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[clang] After 7d2d5a3a6d7, Assertion failed: (getContext().hasSameUnqualifiedType(E->getType(), E->getArg(0)->getType())), function EmitCXXConstructExpr, file clang/lib/CodeGen/CGExprCXX.cpp, line 616
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dimitry@andric.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>While building the FreeBSD math/frobby port (see also
<a href="https://doc.sagemath.org/html/en/reference/spkg/frobby.html">https://doc.sagemath.org/html/en/reference/spkg/frobby.html</a> ) with clang 13 as
part of a large ports build, I encountered the following assertion:

Assertion failed: (getContext().hasSameUnqualifiedType(E->getType(),
E->getArg(0)->getType())), function EmitCXXConstructExpr, file
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGExprCXX.cpp,
line 616.

Program received signal SIGABRT, Aborted.
thr_kill () at thr_kill.S:4
4       RSYSCALL(thr_kill)
(gdb) bt
#0  thr_kill () at thr_kill.S:4
#1  0x00000000066c15af in __raise (s=s@entry=6) at
/share/dim/src/freebsd/llvm-13-update/lib/libc/gen/raise.c:52
#2  0x000000000672b0b9 in abort () at
/share/dim/src/freebsd/llvm-13-update/lib/libc/stdlib/abort.c:67
#3  0x00000000066ac7ba in __assert (func=<optimized out>, file=<optimized out>,
line=<optimized out>, failedexpr=<optimized out>) at
/share/dim/src/freebsd/llvm-13-update/lib/libc/gen/assert.c:51
#4  0x0000000002ce4b94 in EmitCXXConstructExpr () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGExprCXX.cpp:615
#5  0x0000000002ba8b43 in VisitCXXConstructExpr () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp:1315
#6  0x0000000002ba4eb7 in Visit () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp:107
#7  EmitAggExpr () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp:1998
#8  0x0000000002b12837 in EmitReturnStmt () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp:1291
#9  0x0000000002b0f0c9 in EmitStmt () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp:152
#10 0x0000000002b19edc in EmitCompoundStmtWithoutScope () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp:496
#11 0x0000000002afe87d in EmitFunctionBody () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1199
#12 0x0000000002aff3be in GenerateCode () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1373
#13 0x000000000267cf49 in EmitGlobalFunctionDefinition () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:4861
#14 0x0000000002676656 in EmitGlobalDefinition () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:3220
#15 0x000000000267a251 in EmitGlobal () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2982
#16 0x0000000002680332 in EmitTopLevelDecl () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:5698
#17 0x00000000030f974f in HandleTopLevelDecl () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/ModuleBuilder.cpp:170
#18 0x00000000030f6d86 in HandleTopLevelDecl () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:215
#19 0x00000000035cfce7 in ParseAST () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/Parse/ParseAST.cpp:162
#20 0x00000000030378bf in Execute () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/Frontend/FrontendAction.cpp:951
#21 0x0000000002fc10bf in ExecuteAction () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:974
#22 0x00000000030f0d9b in ExecuteCompilerInvocation () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278
#23 0x0000000002615751 in cc1_main () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/tools/driver/cc1_main.cpp:246
#24 0x0000000002622d92 in ExecuteCC1Tool () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/tools/driver/driver.cpp:338
#25 0x0000000002622b80 in main () at
/share/dim/src/freebsd/llvm-13-update/contrib/llvm-project/clang/tools/driver/driver.cpp:409

Bisection shows this to be a regression due to
<a href="https://github.com/llvm/llvm-project/commit/7d2d5a3a6d7">https://github.com/llvm/llvm-project/commit/7d2d5a3a6d7</a> ("[clang] Apply P1825
as Defect Report from C++11 up to C++20").

Reduced test case:

// clang -cc1 -triple x86_64-- -S IntersectFacade-min.cpp
struct a {
  a();
  a(a &);
  a(int);
  template <class b> operator b();
};
a c() {
  if (0) {
    a e;
    return e;
  }
  a d;
  return d;
}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>