public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-6772] c++: consistently diagnose bare CTAD placeholder in fn return type Date: Thu, 20 Jan 2022 14:26:11 +0000 (GMT) [thread overview] Message-ID: <20220120142611.9E2C33858407@sourceware.org> (raw) https://gcc.gnu.org/g:2cda2bfa3fd0f2a0122433d2d870843633e2a312 commit r12-6772-g2cda2bfa3fd0f2a0122433d2d870843633e2a312 Author: Patrick Palka <ppalka@redhat.com> Date: Thu Jan 20 09:22:27 2022 -0500 c++: consistently diagnose bare CTAD placeholder in fn return type Relax slightly the existing check for diagnosing a bare CTAD placeholder as the return type of a function declarator to also handle the abstract declarator case. gcc/cp/ChangeLog: * decl.cc (grokdeclarator): Diagnose a CTAD placeholder as function return type even when !funcdecl_p. gcc/testsuite/ChangeLog: * g++.dg/other/pr88187.C: Adjust expected C++17 diagnostic. Diff: --- gcc/cp/decl.cc | 6 +++--- gcc/testsuite/g++.dg/other/pr88187.C | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 2dade75c489..1cbe9a34be0 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -12647,11 +12647,11 @@ 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 && funcdecl_p) + if (tmpl) { - if (!dguide_name_p (unqualified_id)) + if (!funcdecl_p || !dguide_name_p (unqualified_id)) { - error_at (declarator->id_loc, "deduced class " + error_at (typespec_loc, "deduced class " "type %qD in function return type", DECL_NAME (tmpl)); inform (DECL_SOURCE_LOCATION (tmpl), diff --git a/gcc/testsuite/g++.dg/other/pr88187.C b/gcc/testsuite/g++.dg/other/pr88187.C index 13466d3ce57..7812e3fd5b3 100644 --- a/gcc/testsuite/g++.dg/other/pr88187.C +++ b/gcc/testsuite/g++.dg/other/pr88187.C @@ -4,4 +4,4 @@ template <int> struct A; void f (A ()); // { dg-error "6:variable or field 'f' declared void" "" { target c++14_down } } // { dg-error "missing template arguments before '\\(' token" "" { target c++14_down } .-1 } - // { dg-error "placeholder .A. not permitted in this context" "" { target c++17 } .-2 } + // { dg-error "deduced class type 'A' in function return type" "" { target c++17 } .-2 }
reply other threads:[~2022-01-20 14:26 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220120142611.9E2C33858407@sourceware.org \ --to=ppalka@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).