* decl.c (grokdeclarator): Return error_mark_node for an invalid
trailing return type.
* g++.dg/parse/operator8.C: New test.
From-SVN: r274891
2019-08-23 Marek Polacek <polacek@redhat.com>
+ PR c++/91521 - wrong error with operator->.
+ * decl.c (grokdeclarator): Return error_mark_node for an invalid
+ trailing return type.
+
PR c++/79817 - attribute deprecated on namespace.
* cp-tree.h (cp_warn_deprecated_use_scopes): Declare.
* decl.c (grokdeclarator): Call cp_warn_deprecated_use_scopes.
else if (late_return_type
&& sfk != sfk_conversion)
{
+ if (late_return_type == error_mark_node)
+ return error_mark_node;
if (cxx_dialect < cxx11)
/* Not using maybe_warn_cpp0x because this should
always be an error. */
+2019-08-23 Marek Polacek <polacek@redhat.com>
+
+ PR c++/91521 - wrong error with operator->.
+ * g++.dg/parse/operator8.C: New test.
+
2019-08-23 Segher Boessenkool <segher@kernel.crashing.org>
PR target/91481
--- /dev/null
+// PR c++/91521 - wrong error with operator->.
+// { dg-do compile }
+
+struct foo {
+ int bar() { return 0; }
+ foo* operator->() { return this; }
+};
+
+int main()
+{
+ int pt(foo()->bar());
+ return pt;
+}