[PATCH] D67112: [Sema] Add implicit cast for conversion of function references

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 3 10:34:28 PDT 2019


aaronpuchert created this revision.
aaronpuchert added a reviewer: rsmith.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
aaronpuchert marked 2 inline comments as done.
aaronpuchert added a comment.

If anyone shares my feeling that the boolean output parameters of `CompareReferenceRelationship` should rather move to the return value, I would be happy to do that.



================
Comment at: clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p4-ast.cpp:5
+// CHECK: VarDecl {{.*}} fp 'void (&)()' cinit
+// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void ()':'void ()' lvalue <NoOp>
+// CHECK-NEXT: DeclRefExpr {{.*}} 'void () noexcept' lvalue Function {{.*}} 'f' 'void () noexcept'
----------------
This is new.


================
Comment at: clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p4-ast.cpp:15
+// CHECK: VarDecl {{.*}} xp 'void (&)()' cinit
+// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void ()':'void ()' lvalue <NoOp>
+// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void () noexcept':'void () noexcept' lvalue <UserDefinedConversion>
----------------
This is also new.


When initializing a reference to a non-noexcept function from a noexcept
function we didn't add an implicit cast node, which confused a type-
checking assertion in CodeGen. The same conversion is used for function
pointer conversion already.

Fixes PR43154.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67112

Files:
  clang/include/clang/AST/OperationKinds.def
  clang/include/clang/Sema/Initialization.h
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaCast.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p4-ast.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67112.218484.patch
Type: text/x-patch
Size: 15998 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190903/d85f300c/attachment-0001.bin>


More information about the cfe-commits mailing list