Open Abramo-Bagnara opened 1 year ago
@llvm/issue-subscribers-clang-frontend
I don't think this is entirely unexpected, though the -ast-print behavior is a bug. CXXTemporaryObjectExpr
has the following comments:
/// Represents a C++ functional cast expression that builds a
/// temporary object.
so it's not too surprising that you get a temp object AST node in some cases and a functional cast in others. In this case, I believe what's happening is that use of a type with a consteval constructor results in a functional cast because no temporary object is created in that case. You get the same behavior with int{}
as you do with A{}
, for example.
The presence of
CXXFunctionalCastExpr
is triggered byconsteval
, but I don't see any reason for that.Note also how
-ast-print
is confused by that.