public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111790] New: Unwarranted missing template keyword warning
@ 2023-10-12 16:37 t.bartels@tu-berlin.de
2023-10-12 16:42 ` [Bug c++/111790] " t.bartels@tu-berlin.de
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: t.bartels@tu-berlin.de @ 2023-10-12 16:37 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/111790] Unwarranted missing template keyword warning
2023-10-12 16:37 [Bug c++/111790] New: Unwarranted missing template keyword warning t.bartels@tu-berlin.de
@ 2023-10-12 16:42 ` t.bartels@tu-berlin.de
2023-10-16 23:29 ` [Bug c++/111790] [12/13/14 Regression] " ppalka at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: t.bartels@tu-berlin.de @ 2023-10-12 16:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111790
--- Comment #1 from Tinko Sebastian Bartels <t.bartels@tu-berlin.de> ---
A command line that can trigger the behavior is
g++ main.cpp
One of the versions for which it occurs is
g++ -v
Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/lto-wrapper
Ziel: x86_64-pc-linux-gnu
Konfiguriert mit: /build/gcc/src/gcc/configure
--enable-languages=ada,c,c++,d,fortran,go,lto,objc,obj-c++ --enable-bootstrap
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-multilib --enable-plugin
--enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-werror
Thread-Modell: posix
Unterstützte LTO-Kompressionsalgorithmen: zlib zstd
gcc-Version 13.2.1 20230801 (GCC)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/111790] [12/13/14 Regression] Unwarranted missing template keyword warning
2023-10-12 16:37 [Bug c++/111790] New: Unwarranted missing template keyword warning t.bartels@tu-berlin.de
2023-10-12 16:42 ` [Bug c++/111790] " t.bartels@tu-berlin.de
@ 2023-10-16 23:29 ` ppalka at gcc dot gnu.org
2024-02-01 23:25 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-10-16 23:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111790
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.4
Summary|Unwarranted missing |[12/13/14 Regression]
|template keyword warning |Unwarranted missing
| |template keyword warning
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-10-16
CC| |ppalka at gcc dot gnu.org
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/111790] [12/13/14 Regression] Unwarranted missing template keyword warning
2023-10-12 16:37 [Bug c++/111790] New: Unwarranted missing template keyword warning t.bartels@tu-berlin.de
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
2024-06-20 9:14 ` [Bug c++/111790] [12/13/14/15 " rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-02-01 23:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111790
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r12-6563-gb8ffa71e4271ae:
commit b8ffa71e4271ae562c2d315b9b24c4979bbf8227
Author: Anthony Sharp <anthonysharp15@gmail.com>
Date: Sat Dec 4 17:23:22 2021 +0000
c++: warning for dependent template members [PR70417]
But is seems to me this is the case of a false positive
<https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmissing-template-keyword>
talks about. Wrapping "x.v < 0" in () suppresses the warning.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/111790] [12/13/14 Regression] Unwarranted missing template keyword warning
2023-10-12 16:37 [Bug c++/111790] New: Unwarranted missing template keyword warning t.bartels@tu-berlin.de
` (2 preceding siblings ...)
2024-02-01 23:25 ` mpolacek at gcc dot gnu.org
@ 2024-03-07 21:05 ` law at gcc dot gnu.org
2024-06-20 9:14 ` [Bug c++/111790] [12/13/14/15 " rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-07 21:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111790
Jeffrey A. Law <law at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |law at gcc dot gnu.org
Priority|P3 |P2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/111790] [12/13/14/15 Regression] Unwarranted missing template keyword warning
2023-10-12 16:37 [Bug c++/111790] New: Unwarranted missing template keyword warning t.bartels@tu-berlin.de
` (3 preceding siblings ...)
2024-03-07 21:05 ` law at gcc dot gnu.org
@ 2024-06-20 9:14 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-06-20 9:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111790
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.4 |12.5
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12.4 is being released, retargeting bugs to GCC 12.5.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-06-20 9:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-12 16:37 [Bug c++/111790] New: Unwarranted missing template keyword warning t.bartels@tu-berlin.de
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
2024-06-20 9:14 ` [Bug c++/111790] [12/13/14/15 " 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).