Created attachment 41321 [details] 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&>()))".
I can't reproduce this with 20170619. Are you still seeing it?
(In reply to Jason Merrill from comment #1) > I can't reproduce this with 20170619. Are you still seeing it? Nope - it appears to have disappeared on trunk.
Then closing as fixed.