@@ -7520,6 +7520,13 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
&& DECL_INITIALIZED_IN_CLASS_P (decl))
check_static_variable_definition (decl, type);
+ if (!processing_template_decl
+ && VAR_P (decl)
+ && DECL_FUNCTION_SCOPE_P (decl)
+ && TREE_STATIC (decl))
+ verify_type_context (DECL_SOURCE_LOCATION (decl),
+ TCTX_STATIC_STORAGE, type);
+
if (init && TREE_CODE (decl) == FUNCTION_DECL)
{
tree clone;
new file mode 100644
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+#include <arm_sve.h>
+
+template <int N>
+void f()
+{
+ static svbool_t pg = svwhilelt_b64(0, N);
+}
+
+int main(int argc, char **argv)
+{
+ f<2>();
+ return 0;
+}
+
+/* { dg-error {SVE type 'svbool_t' does not have a fixed size} } */