[Bug c++/53788] C++11 decltype sfinae static member function check (4.7.1)

daniel.kruegler at googlemail dot com gcc-bugzilla@gcc.gnu.org
Wed Jun 27 22:30:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53788

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-06-27 22:30:33 UTC ---
The problem also persists in gcc 4.8.0 20120624 (experimental).

Simplified example free from library dependencies:

struct t { static const bool value = true; };
struct f { static const bool value = false; };

template<typename T>
struct has_static {
  template<typename X>
  static t check(X*, decltype(T::fun())* = 0);
  static f check(...);

  typedef decltype(check((T*)(0))) ret;
  static const bool value = ret::value;
};

struct test { int fun() { return 0; } };

bool b = has_static<test>::value;



More information about the Gcc-bugs mailing list