gcc/cp/
* parser.c (cp_parser_constraint_requires_parens): Exclude
attributes as postfix expressions.
gcc/testsuite/
* g++.dg/concepts-pr92739.C: New test.
From-SVN: r279935
+2020-01-06 Andrew Sutton <asutton@lock3software.com>
+
+ PR c++/92739 - parsing requires clause with attributes.
+ * parser.c (cp_parser_constraint_requires_parens): Exclude
+ attributes as postfix expressions.
+
2020-01-05 Jakub Jelinek <jakub@redhat.com>
PR c++/93138
gcc_fallthrough ();
}
case CPP_OPEN_SQUARE:
+ {
+ /* A primary-constraint-expression followed by a '[[' is not a
+ postfix expression. */
+ if (cp_lexer_nth_token_is (parser->lexer, 2, CPP_OPEN_SQUARE))
+ return pce_ok;
+
+ gcc_fallthrough ();
+ }
case CPP_PLUS_PLUS:
case CPP_MINUS_MINUS:
case CPP_DOT:
--- /dev/null
+// PR c++/92739
+// { dg-do compile { target concepts } }
+
+template <class T>
+concept C = true;
+
+template <class T>
+ requires C<T>
+[[nodiscard]] int f(T t) {
+ return 22;
+}
+
+int main() {
+ return 0;
+}