]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/88187 (ICE on (invalid) C++ code when compiled with -std=c++17: Segmentatio...
authorJakub Jelinek <jakub@redhat.com>
Tue, 27 Nov 2018 23:52:26 +0000 (00:52 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 27 Nov 2018 23:52:26 +0000 (00:52 +0100)
PR c++/88187
* decl.c (grokdeclarator): Don't diagnose deduction guide errors
if !funcdecl_p.

* g++.dg/other/pr88187.C: New test.

From-SVN: r266537

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

index 41e66c082974372e6c8860ea9ba505a2b38b60e6..fea3cf6650747fb64c09bf2228863e586f77ccdc 100644 (file)
@@ -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.
index 1eee29e0d59852872387c381154f10c67d5275e2..1aaf51750ab1a49cafd209c426cb37fdbdfe4dfb 100644 (file)
@@ -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))
                          {
index d35a3f87cd1bb58fbbf5d317368ac73f4460cd81..ce80f72266d298d3aeebf90efefe3e2316ccbfc6 100644 (file)
@@ -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 (file)
index 0000000..17c14f4
--- /dev/null
@@ -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 }