re PR c++/83895 (-Wparentheses warns about pointer-to-member typedefs)
authorVille Voutilainen <ville.voutilainen@gmail.com>
Mon, 22 Jan 2018 12:44:33 +0000 (14:44 +0200)
committerVille Voutilainen <ville@gcc.gnu.org>
Mon, 22 Jan 2018 12:44:33 +0000 (14:44 +0200)
PR c++/83895

cp/

* decl.c (grokdeclarator): Don't diagnose extra parens
on typedefs.

testsuite/

* g++.dg/warn/83895.C: New.

From-SVN: r256942

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.dg/warn/83895.C [new file with mode: 0644]

index 5bad14dadd0940e52cbeb36cc95745602945c445..0652662f6a19e4f08e5defade2b946a116f349fa 100644 (file)
@@ -1,3 +1,10 @@
+2018-01-22  Ville Voutilainen  <ville.voutilainen@gmail.com>
+
+       PR c++/83895
+
+       * decl.c (grokdeclarator): Don't diagnose extra parens
+       on typedefs.
+
 2018-01-19  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/81167
index 039ddd92cb7f890aecf6795549cad6bb6da04348..230e7ddb88037b6685c540aaa872dafd01929be7 100644 (file)
@@ -10882,6 +10882,7 @@ grokdeclarator (const cp_declarator *declarator,
         to be a constructor call.  */
       if (decl_context != PARM
          && decl_context != TYPENAME
+         && !typedef_p
          && declarator->parenthesized != UNKNOWN_LOCATION
          /* If the type is class-like and the inner name used a
             global namespace qualifier, we need the parens.
diff --git a/gcc/testsuite/g++.dg/warn/83895.C b/gcc/testsuite/g++.dg/warn/83895.C
new file mode 100644 (file)
index 0000000..86b317f
--- /dev/null
@@ -0,0 +1,7 @@
+// { dg-additional-options -Wparentheses }
+// { dg-do compile { target c++11 } }
+
+struct X;
+
+typedef int (X::*foo);
+using bar = int (X::*);