https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80633
Bug ID: 80633 Summary: [7/8 Regression] -Wstrict-aliasing false positive Product: gcc Version: 7.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Casey at Carter dot net Target Milestone: --- Created attachment 41321 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41321&action=edit Repro (sorry, not library-free) gcc 7.1.1 20170504 and 8.0.0 20170504 - but not 6.2/5.4/4.9.4 - incorrectly diagnose this program: #include <fstream> extern void f(std::istream&); std::ifstream ss; using T = decltype(f(ss)); // warning: dereferencing type-punned pointer will break strict-aliasing rules when compiling with "gcc -Wstrict-aliasing -O2 -c". The diagnostic is notably not emitted for "decltype(f(std::declval<std::ifstream&>()))".