@@ -12107,7 +12107,12 @@ check_trait_type (tree type, int kind = 1)
if (VOID_TYPE_P (type))
return true;
- return !!complete_type_or_else (strip_array_types (type), NULL_TREE);
+ type = complete_type (strip_array_types (type));
+ if (!COMPLETE_TYPE_P (type)
+ && cxx_incomplete_type_diagnostic (NULL_TREE, type, DK_PERMERROR)
+ && !flag_permissive)
+ return false;
+ return true;
}
/* Process a trait expression. */
@@ -298,10 +298,6 @@ cxx_incomplete_type_diagnostic (location_t loc, const_tree value,
{
bool is_decl = false, complained = false;
- gcc_assert (diag_kind == DK_WARNING
- || diag_kind == DK_PEDWARN
- || diag_kind == DK_ERROR);
-
/* Avoid duplicate error message. */
if (TREE_CODE (type) == ERROR_MARK)
return false;
new file mode 100644
@@ -0,0 +1,7 @@
+// PR c++/109277
+// { dg-do compile { target c++11 } }
+// { dg-options -fpermissive }
+
+struct a;
+struct b{};
+static_assert (!__is_convertible (a, b), ""); // { dg-warning "incomplete" }