Commit e164534f by Marek Polacek Committed by Marek Polacek

re PR c++/83592 (Annoying -Wparentheses warnings)

	PR c++/83592
	* decl.c (grokdeclarator): Don't warn about MVP in typename context.

	* g++.dg/warn/mvp2.C: New test.

From-SVN: r256176
parent e30947eb
2018-01-03 Marek Polacek <polacek@redhat.com>
PR c++/83592
* decl.c (grokdeclarator): Don't warn about MVP in typename context.
2018-01-03 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/83602
......
......@@ -10866,10 +10866,11 @@ grokdeclarator (const cp_declarator *declarator,
inner_declarator = declarator->declarator;
/* We don't want to warn in parmeter context because we don't
/* We don't want to warn in parameter context because we don't
yet know if the parse will succeed, and this might turn out
to be a constructor call. */
if (decl_context != PARM
&& decl_context != TYPENAME
&& declarator->parenthesized != UNKNOWN_LOCATION
/* If the type is class-like and the inner name used a
global namespace qualifier, we need the parens.
......
2018-01-03 Marek Polacek <polacek@redhat.com>
PR c++/83592
* g++.dg/warn/mvp2.C: New test.
2018-01-03 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/83602
......
// PR c++/83592
// { dg-do compile }
// { dg-options "-Wparentheses" }
// Test that -Wparentheses does not give bogus warnings in
// typename context.
int *
foo (long &a)
{
return reinterpret_cast<int (*)> (&a);
}
int *
bar (long &a)
{
return (int (*)) &a;
}
int *
baz (int &a)
{
return static_cast<int (*const)> (&a);
}
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