@@ -3143,6 +3143,10 @@ void reference_binds_to_temporary_checks() {
31433143 static_assert (!(__reference_binds_to_temporary (int , long )));
31443144
31453145 static_assert ((__reference_binds_to_temporary (const int &, long )));
3146+
3147+ // Test that function references are never considered bound to temporaries.
3148+ static_assert (!__reference_binds_to_temporary (void (&)(), void ()));
3149+ static_assert (!__reference_binds_to_temporary (void (&&)(), void ()));
31463150}
31473151
31483152
@@ -3156,6 +3160,14 @@ struct ExplicitConversionRef {
31563160 explicit operator int &();
31573161};
31583162
3163+ struct NonMovable {
3164+ NonMovable (NonMovable&&) = delete ;
3165+ };
3166+
3167+ struct ConvertsFromNonMovable {
3168+ ConvertsFromNonMovable (NonMovable);
3169+ };
3170+
31593171void reference_constructs_from_temporary_checks () {
31603172 static_assert (!__reference_constructs_from_temporary (int &, int &));
31613173 static_assert (!__reference_constructs_from_temporary (int &, int &&));
@@ -3193,6 +3205,16 @@ void reference_constructs_from_temporary_checks() {
31933205
31943206 static_assert (__reference_constructs_from_temporary (const int &, long ));
31953207
3208+ // Test that function references are never considered bound to temporaries.
3209+ static_assert (!__reference_constructs_from_temporary (void (&&)(), void ()));
3210+ static_assert (!__reference_constructs_from_temporary (void (&)(), void ()));
3211+
3212+ // LWG3819: reference_meows_from_temporary should not use is_meowible
3213+ static_assert (__reference_constructs_from_temporary (ConvertsFromNonMovable&&, NonMovable) == __cplusplus >= 201703L );
3214+ // For scalar types, cv-qualifications are dropped first for prvalues.
3215+ static_assert (__reference_constructs_from_temporary (int &&, const int ));
3216+ static_assert (__reference_constructs_from_temporary (int &&, volatile int ));
3217+
31963218 // Additional checks
31973219 static_assert (__reference_constructs_from_temporary (POD const &, Derives));
31983220 static_assert (__reference_constructs_from_temporary (int &&, int ));
@@ -3250,6 +3272,16 @@ void reference_converts_from_temporary_checks() {
32503272
32513273 static_assert (__reference_converts_from_temporary (const int &, long ));
32523274
3275+ // Test that function references are never considered bound to temporaries.
3276+ static_assert (!__reference_converts_from_temporary (void (&)(), void ()));
3277+ static_assert (!__reference_converts_from_temporary (void (&&)(), void ()));
3278+
3279+ // LWG3819: reference_meows_from_temporary should not use is_meowible
3280+ static_assert (__reference_converts_from_temporary (ConvertsFromNonMovable&&, NonMovable) == __cplusplus >= 201703L );
3281+ // For scalar types, cv-qualifications are dropped first for prvalues.
3282+ static_assert (__reference_converts_from_temporary (int &&, const int ));
3283+ static_assert (__reference_converts_from_temporary (int &&, volatile int ));
3284+
32533285 // Additional checks
32543286 static_assert (__reference_converts_from_temporary (POD const &, Derives));
32553287 static_assert (__reference_converts_from_temporary (int &&, int ));
0 commit comments