public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cuzdav at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105511] New: Spurious warning: "expected 'template' keyword..." when lt and gt compare over ternary Date: Fri, 06 May 2022 23:50:14 +0000 [thread overview] Message-ID: <bug-105511-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105511 Bug ID: 105511 Summary: Spurious warning: "expected 'template' keyword..." when lt and gt compare over ternary Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: cuzdav at gmail dot com Target Milestone: --- Only on g++ 12 (new warning). Building with the freshly released G++12 with warning enabled (-Werror=missing-template-keyword) Complete, minimized code: template <typename X> bool before(bool ascending, X & a, X * b) { return ascending ? a.value < (*b).value : a.value > (*b).value; } <source>:4:26: warning: expected 'template' keyword before dependent template name [-Wmissing-template-keyword] 4 | return ascending ? a.value < (*b).value : a.value > (*b).value; | ^~~~~ Visible on Compiler Explorer https://godbolt.org/z/dW9hjbdex Yes, the left-angle and right-angle brackets are present, but it's not looking quite hard enough to see that they are on opposite sides of a ternary ':'. My Compiler, if it matters: /opt/imc/gcc-12.1.0/bin/g++ (base) bash-4.2$ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/opt/imc/gcc-12.1.0/libexec/gcc/x86_64-pc-linux-gnu/12.1.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-12.1.0/configure --prefix=/opt/imc/gcc-12.1.0 --enable-languages=c,c++,fortran,lto --disable-multilib --with-build-time-tools=/home/trading/cuzdav/code/imc-gcc/gcc/12.1.0/INSTALLDIR//opt/imc/gcc-12.1.0/bin --enable-libstdcxx-time=rt Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.1.0 (GCC)
next reply other threads:[~2022-05-06 23:50 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-06 23:50 cuzdav at gmail dot com [this message] 2022-10-31 1:45 ` [Bug c++/105511] [12/13 Regression] " pinskia at gcc dot gnu.org 2022-10-31 20:43 ` mpolacek at gcc dot gnu.org 2022-12-20 13:42 ` rguenth 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-105511-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).