aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-11-27 23:52:26 +0000
committerJakub Jelinek <jakub@redhat.com>2018-11-27 23:52:26 +0000
commite629cef2877cf5cae27eadb3efa49689edc90ed7 (patch)
tree7b71e42a7f747eb5583c274cf567a847a7dee92e
parent2def15b061cde564edd43ca334ffa1c1bf193593 (diff)
PR c++/88187
* decl.c (grokdeclarator): Don't diagnose deduction guide errors if !funcdecl_p. * g++.dg/other/pr88187.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@266537 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/other/pr88187.C7
4 files changed, 15 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 41e66c08297..fea3cf66507 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2018-11-27 Jakub Jelinek <jakub@redhat.com>
+ PR c++/88187
+ * decl.c (grokdeclarator): Don't diagnose deduction guide errors
+ if !funcdecl_p.
+
PR c++/88181
* class.c (fixup_attribute_variants): Also propagate TYPE_PACKED
to variants.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 1eee29e0d59..1aaf51750ab 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -11276,7 +11276,7 @@ grokdeclarator (const cp_declarator *declarator,
if (!tmpl)
if (tree late_auto = type_uses_auto (late_return_type))
tmpl = CLASS_PLACEHOLDER_TEMPLATE (late_auto);
- if (tmpl)
+ if (tmpl && funcdecl_p)
{
if (!dguide_name_p (unqualified_id))
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d35a3f87cd1..ce80f72266d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2018-11-27 Jakub Jelinek <jakub@redhat.com>
+ PR c++/88187
+ * g++.dg/other/pr88187.C: New test.
+
PR c++/88181
* g++.dg/debug/pr88181.C: New test.
diff --git a/gcc/testsuite/g++.dg/other/pr88187.C b/gcc/testsuite/g++.dg/other/pr88187.C
new file mode 100644
index 00000000000..17c14f4e552
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/pr88187.C
@@ -0,0 +1,7 @@
+// PR c++/88187
+// { dg-do compile }
+
+template <int> struct A;
+void f (A ()); // { dg-error "variable or field 'f' declared void" "" { target c++14_down } }
+ // { dg-error "missing template arguments before '\\(' token" "" { target c++14_down } .-1 }
+ // { dg-error "'auto' parameter not permitted in this context" "" { target c++17 } .-2 }