// FIXME: Implement pointers to members. For now, don't associate a value
// with this expression.
break;
- case CK_FunctionToPointerDecay:
- case CK_BuiltinFnToFnPtr: {
+ case CK_FunctionToPointerDecay: {
StorageLocation *PointeeLoc =
Env.getStorageLocation(*SubExpr, SkipPast::Reference);
if (PointeeLoc == nullptr)
Env.setValue(PointerLoc, PointerVal);
break;
}
+ case CK_BuiltinFnToFnPtr:
+ // Despite its name, the result type of `BuiltinFnToFnPtr` is a function,
+ // not a function pointer. In addition, builtin functions can only be
+ // called directly; it is not legal to take their address. We therefore
+ // don't need to create a value or storage location for them.
+ break;
default:
break;
}
});
}
-// Check that the pointer that a builtin function decays to is associated with
-// a value.
+// Check that a builtin function is not associated with a value. (It's only
+// possible to call builtin functions directly, not take their address.)
TEST(TransferTest, BuiltinFunctionModeled) {
std::string Code = R"(
void target() {
ASTCtx));
ASSERT_THAT(ImplicitCast, NotNull());
- EXPECT_THAT(Env.getValueStrict(*ImplicitCast), NotNull());
+ EXPECT_THAT(Env.getValueStrict(*ImplicitCast), IsNull());
});
}