[Bug c++/66717] In variable declaration, decltype incorrectly deduces return type of function returning const reference to int

charlie at charliedyson dot net gcc-bugzilla@gcc.gnu.org
Wed Jul 1 10:41:00 GMT 2015


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&>(), "");



More information about the Gcc-bugs mailing list