return error_mark_node;
}
else if (cxx_dialect < cxx23)
- pedwarn (input_location, OPT_Wc__23_extensions,
- "%<auto{x}%> only available with "
- "%<-std=c++23%> or %<-std=gnu++23%>");
+ {
+ if ((complain & tf_warning_or_error) == 0)
+ return error_mark_node;
+ pedwarn (input_location, OPT_Wc__23_extensions,
+ "%<auto{x}%> only available with "
+ "%<-std=c++23%> or %<-std=gnu++23%>");
+ }
type = do_auto_deduction (type, compound_literal, type, complain,
adc_variable_type);
if (type == error_mark_node)
return error_mark_node;
}
else if (cxx_dialect < cxx23)
- pedwarn (loc, OPT_Wc__23_extensions,
- "%<auto(x)%> only available with "
- "%<-std=c++23%> or %<-std=gnu++23%>");
+ {
+ if ((complain & tf_warning_or_error) == 0)
+ return error_mark_node;
+ pedwarn (loc, OPT_Wc__23_extensions,
+ "%<auto(x)%> only available with "
+ "%<-std=c++23%> or %<-std=gnu++23%>");
+ }
}
else
{
--- /dev/null
+// PR c++/120685
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+template <typename T>
+void foo (decltype (auto (T ())) x) {} // { dg-warning "'auto\\\(x\\\)' only available with" "" { target c++20_down } }
+
+int
+main ()
+{
+ foo <int> (1); // { dg-error "no matching function for call to 'foo<int>\\\(int\\\)'" "" { target c++20_down } }
+}