From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 37B27385743D; Thu, 16 Sep 2021 22:25:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 37B27385743D From: "msebor at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on target_milestone everconfirmed Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 22:25:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102378 Martin Sebor 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 --- (In reply to Andrew Pinski from comment #2) > (In reply to Andrew Pinski from comment #1) > > GCC warns only at instantiation time. >=20 > 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 void f () { volatile struct A a; // -Wredundant-tags (good) register int n =3D sizeof a; // -Wregister (good) __builtin_memset (&a, 0, n); // missing -Wclass-memaccess and volatile= A* to A* conversion warning } t.C: In function =E2=80=98void f()=E2=80=99: t.C:6:12: warning: redundant class-key =E2=80=98struct=E2=80=99 in referenc= e to =E2=80=98struct A=E2=80=99 [-Wredundant-tags] 6 | volatile struct A a; // -Wredundant-tags (good) | ^~~~~~ | ------ t.C:7:16: warning: ISO C++17 does not allow =E2=80=98register=E2=80=99 stor= age class specifier [-Wregister] 7 | register int n =3D sizeof a; // -Wregister (good) | ^=