public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "t.bartels@tu-berlin.de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/111790] New: Unwarranted missing template keyword warning Date: Thu, 12 Oct 2023 16:37:35 +0000 [thread overview] Message-ID: <bug-111790-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111790 Bug ID: 111790 Summary: Unwarranted missing template keyword warning Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: t.bartels@tu-berlin.de Target Milestone: --- Consider the following code: template <typename T> //no warning if this is not a template struct X { T v; }; template <typename T> inline void f() { X<T> x; //no warning with e.g. X<int> if(x.v < 0 && 0 > -1) {} //No warning without the "-" } int main() { f<int>(); //Still get a warning without this instantiation. } GCC 12, 13, current trunk and seemingly everything after b8ffa71e427 give me a warning for this: warning: expected 'template' keyword before dependent template name [-Wmissing-template-keyword] But GCC compiles it, so it seems to interpret it correctly at some point after triggering the warning. I tried to look into it and thought that maybe cp_lexer_peek_token (parser->lexer)->type <= CPP_LAST_PUNCTUATOR in line 6447 of gcc/cp/parser.cc is too general but I do not have a proposed patch.
next reply other threads:[~2023-10-12 16:37 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-10-12 16:37 t.bartels@tu-berlin.de [this message] 2023-10-12 16:42 ` [Bug c++/111790] " t.bartels@tu-berlin.de 2023-10-16 23:29 ` [Bug c++/111790] [12/13/14 Regression] " ppalka at gcc dot gnu.org 2024-02-01 23:25 ` mpolacek at gcc dot gnu.org 2024-03-07 21:05 ` law at gcc dot gnu.org
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=bug-111790-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).