We'd missed providing a diagnostic when checking a non-scalar non-class
type, such as a function type.
gcc/cp/ChangeLog:
* method.cc (destructible_expr): Add explanation when type is
neither class nor scalar.
gcc/testsuite/ChangeLog:
* g++.dg/ext/is_destructible3.C: Add test for function type.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
else if (scalarish_type_p (to))
return void_node;
else
- return error_mark_node;
+ {
+ if (explain)
+ error_at (location_of (to), "%qT is not a class or scalar type", to);
+ return error_mark_node;
+ }
}
/* Returns a tree iff TO is assignable (if CODE is MODIFY_EXPR) or
// { dg-message "'void' is not destructible, because" "" { target *-*-* } .-1 }
// { dg-error "'void' is incomplete" "" { target *-*-* } .-2 }
+static_assert(is_destructible<void() volatile>::value, ""); // { dg-error "assert" }
+// { dg-message "'void\\(\\) volatile' is not destructible, because" "" { target *-*-* } .-1 }
+// { dg-error "not a class or scalar type" "" { target *-*-* } .-2 }
+
struct A {
~A() = delete; // { dg-message "declared here" }
};