public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/102378] missing -Waddress in template code at definition time rather than instantiation
Date: Thu, 16 Sep 2021 22:25:51 +0000 [thread overview]
Message-ID: <bug-102378-4-GOCgJ9SXW0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102378-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102378
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2021-09-16
Target Milestone|--- |12.0
Ever confirmed|0 |1
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > GCC warns only at instantiation time.
>
> And it has been that way since at least 4.4.0.
Not quite. It depends on where a warning is implemented. As the test case
below shows, G++ does diagnose some problems in uninstantiated templates but
not others. Jason's suggestion in the review I pointed to is to try to do
better and the purpose of this bug is to capture that limitation and
improvement for the work I'm doing.
$ cat t.C && gcc -S -Wall -Wredundant-tags t.C
struct A { A (); ~A (); };
template <class T>
void f ()
{
volatile struct A a; // -Wredundant-tags (good)
register int n = sizeof a; // -Wregister (good)
__builtin_memset (&a, 0, n); // missing -Wclass-memaccess and volatile A*
to A* conversion warning
}
t.C: In function ‘void f()’:
t.C:6:12: warning: redundant class-key ‘struct’ in reference to ‘struct A’
[-Wredundant-tags]
6 | volatile struct A a; // -Wredundant-tags (good)
| ^~~~~~
| ------
t.C:7:16: warning: ISO C++17 does not allow ‘register’ storage class specifier
[-Wregister]
7 | register int n = sizeof a; // -Wregister (good)
| ^
next prev parent reply other threads:[~2021-09-16 22:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-16 21:19 [Bug c++/102378] New: missing -Waddress in template code msebor at gcc dot gnu.org
2021-09-16 21:24 ` [Bug c++/102378] " pinskia at gcc dot gnu.org
2021-09-16 21:28 ` [Bug c++/102378] missing -Waddress in template code at definition time rather than instantiation pinskia at gcc dot gnu.org
2021-09-16 22:11 ` msebor at gcc dot gnu.org
2021-09-16 22:25 ` msebor at gcc dot gnu.org [this message]
2022-05-06 8:31 ` jakub at gcc dot gnu.org
2023-05-08 12:22 ` rguenth at gcc dot gnu.org
2024-06-20 8:58 ` 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-102378-4-GOCgJ9SXW0@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: link
Be 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).