an opening angle if present. */
if (cp_lexer_next_token_is (parser->lexer, CPP_LESS))
{
- if (cxx_dialect < cxx14)
- pedwarn (parser->lexer->next_token->location, OPT_Wc__14_extensions,
- "lambda templates are only available with "
- "%<-std=c++14%> or %<-std=gnu++14%>");
- else if (pedantic && cxx_dialect < cxx20)
+ if (cxx_dialect < cxx20
+ && (pedantic || cxx_dialect < cxx14))
pedwarn (parser->lexer->next_token->location, OPT_Wc__20_extensions,
"lambda templates are only available with "
"%<-std=c++20%> or %<-std=gnu++20%>");
templated_operator_saved_lookups (t),
complain));
- case ANNOTATE_EXPR:
- tmp = RECUR (TREE_OPERAND (t, 0));
- RETURN (build3_loc (EXPR_LOCATION (t), ANNOTATE_EXPR,
- TREE_TYPE (tmp), tmp,
- RECUR (TREE_OPERAND (t, 1)),
- RECUR (TREE_OPERAND (t, 2))));
-
case PREDICT_EXPR:
RETURN (add_stmt (copy_node (t)));
EXPR_LOCATION (t)));
/* fallthrough. */
+ case ANNOTATE_EXPR:
+ op1 = RECUR (TREE_OPERAND (t, 0));
+ RETURN (build3_loc (EXPR_LOCATION (t), ANNOTATE_EXPR,
+ TREE_TYPE (op1), op1,
+ RECUR (TREE_OPERAND (t, 1)),
+ RECUR (TREE_OPERAND (t, 2))));
+
default:
/* Handle Objective-C++ constructs, if appropriate. */
{
--- /dev/null
+// PR c++/111529
+// { dg-do compile { target c++11 } }
+// { dg-additional-options -Wno-c++20-extensions }
+
+template <int>
+void f() {
+ []<int>() {
+ #pragma GCC unroll 9
+ for (int i = 1; i; --i) {
+ }
+ };
+}
+
+int main() {
+ f<0>();
+}