Technically 'noexcept' isn't a qualifier, so this should be a separate conversion.
Also add a pure AST test for the conversion.
Paths
| Differential D67112
[Sema] Introduce function reference conversion, NFC ClosedPublic Authored by aaronpuchert on Sep 3 2019, 10:30 AM.
Details
Summary Technically 'noexcept' isn't a qualifier, so this should be a separate conversion. Also add a pure AST test for the conversion.
Diff Detail
Event TimelineComment Actions
I'll do that in a separate change and then rebase this on top. aaronpuchert retitled this revision from [Sema] Add implicit cast for conversion of function references to [Sema] Introduce function reference conversion.Feb 26 2020, 5:53 PM aaronpuchert retitled this revision from [Sema] Introduce function reference conversion to [Sema] Introduce function reference conversion, NFC.Apr 22 2020, 5:10 PM Comment Actions@rsmith, what do you think about this? Comment Actions Ping. Maybe this change is too silly, but I think it's better to be precise and not muddle qualification conversions together with casting away noexcept. Comment Actions Looks fine as far as it goes, but it looks like we're also missing a cast in function pointer initialization via function conversion: void f() noexcept; void (*p)() = f; results in |-VarDecl 0x105143e8 <line:2:1, col:15> col:8 p 'void (*)()' cinit | `-ImplicitCastExpr 0x10514498 <col:15> 'void (*)() noexcept' <FunctionToPointerDecay> | `-DeclRefExpr 0x10514450 <col:15> 'void () noexcept' lvalue Function 0x10514240 'f' 'void () noexcept' This revision is now accepted and ready to land.Nov 16 2020, 6:37 PM Comment Actions
It seems to depend on the standard, with -std=c++17: |-VarDecl p 'void (*)()' cinit | `-ImplicitCastExpr 'void (*)()' <NoOp> | `-ImplicitCastExpr 'void (*)() noexcept' <FunctionToPointerDecay> | `-DeclRefExpr 'void () noexcept' lvalue Function 'f' 'void () noexcept' Perhaps because pre-C++17 noexcept is not part of the type, so we essentially ignore it? Comment Actions
Oh, right, my bad. I forgot we still default to C++14 :) Closed by commit rG825f80e111f2: [Sema] Introduce function reference conversion, NFC (authored by aaronpuchert). · Explain WhyNov 22 2020, 11:52 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 306929 clang/include/clang/AST/OperationKinds.def
clang/include/clang/Sema/Initialization.h
clang/lib/Sema/SemaInit.cpp
clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p4-ast.cpp
|
This is new.