Commit 9bf6c63d by Marek Polacek Committed by Marek Polacek

PR c++/91521 - wrong error with operator->.

	* decl.c (grokdeclarator): Return error_mark_node for an invalid
	trailing return type.

	* g++.dg/parse/operator8.C: New test.

From-SVN: r274891
parent 6ae361ae
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.
......
......@@ -11549,6 +11549,8 @@ grokdeclarator (const cp_declarator *declarator,
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
......
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment