This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/52224] [C++0x] Generic operator gets pulled into compile-time expression


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

--- Comment #2 from Daniel KrÃgler <daniel.kruegler at googlemail dot com> 2012-02-13 09:26:34 UTC ---
I condensed the test case further down to the following:

//---
template<bool, class> struct enable_if {};
template<class T> struct enable_if<true, T> { typedef T type; };

template <typename T> struct is_mine { enum { value = false }; };

template <typename E1, typename E2>
struct either_is_mine { static const bool value = is_mine<E1>::value ||
is_mine<E2>::value; };

template <typename E1, typename E2>
typename enable_if<either_is_mine<E1, E2>::value, int>::type
operator||(E1 e1, E2 e2);

template <typename E1, typename E2>
typename enable_if<either_is_mine<E1, E2>::value, int>::type
test(E1 e1, E2 e2);

const int n = sizeof(test(1, 2));
//---


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]