http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57460
Bug ID: 57460 Summary: [C++11] Sfinae doesn't respect dependent context Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: daniel.kruegler at googlemail dot com gcc 4.9.0 20130519 (experimental) compiled with the flags -std=c++11 -Wall -pedantic-errors rejects the following code: //------------------------------------ int get_int(); #define EXPR get_int() template<int> static void check(); template<class T> static auto test(decltype(check<(EXPR, T())>(), T())) -> char(&)[1]; template<class> static auto test(...) -> char(&)[2]; static_assert(sizeof(test<int>(0)) != 1, "Ouch"); //------------------------------------ complaining: "main.cpp|3|error: call to non-constexpr function 'int get_int()'| main.cpp|9|note: in expansion of macro 'EXPR'|" Albeit EXPR itself is a non-dependent expression, the overall decltype type declaration in the declaration of the first test overload should be. clang 3.4 accepts the code as well.