]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Avoid strict_aliasing_warning on dependent types or expressions [PR94951]
authorJakub Jelinek <jakub@redhat.com>
Wed, 6 May 2020 21:38:13 +0000 (23:38 +0200)
committerJakub Jelinek <jakub@redhat.com>
Thu, 7 May 2020 13:20:27 +0000 (15:20 +0200)
commitd82414ebcf7716ea24688510594a2c464a105908
treef6648290bac811ab26af886b4ec0800c2636a916
parent3d4c7e05de438fb0672f376e628c18812eea8982
c++: Avoid strict_aliasing_warning on dependent types or expressions [PR94951]

The following testcase gets a bogus warning during build_base_path,
when cp_build_indirect_ref* calls strict_aliasing_warning with a dependent
expression.  IMHO calling get_alias_set etc. on dependent types feels wrong
to me, we should just defer the warnings in those cases until instantiation
and only handle the cases where neither type nor expr are dependent.

2020-05-06  Jakub Jelinek  <jakub@redhat.com>

PR c++/94951
* typeck.c (cp_strict_aliasing_warning): New function.
(cp_build_indirect_ref_1, build_reinterpret_cast_1): Use
it instead of strict_aliasing_warning.

* g++.dg/warn/Wstrict-aliasing-bogus-tmpl.C: New test.
gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-tmpl.C [new file with mode: 0644]