https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66717
--- Comment #2 from Charlie <charlie at charliedyson dot net> --- I think you may be right that it's only the diagnostic that's wrong. The following compiles fine https://goo.gl/eyuv17 static int foo = 1; decltype (const_ref_to_int ()) x = foo; static_assert (std::is_same<decltype (x), const int&>(), "");