public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105511] New: Spurious warning: "expected 'template' keyword..." when lt and gt compare over ternary
@ 2022-05-06 23:50 cuzdav at gmail dot com
  2022-10-31  1:45 ` [Bug c++/105511] [12/13 Regression] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: cuzdav at gmail dot com @ 2022-05-06 23:50 UTC (permalink / raw)
  To: gcc-bugs

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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-20 13:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 23:50 [Bug c++/105511] New: Spurious warning: "expected 'template' keyword..." when lt and gt compare over ternary cuzdav at gmail dot com
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

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).