// { dg-do compile { target c++11 } } // PR c++/86246 ICE in tsubst namespace std { template struct is_class { static constexpr bool value = true; }; template<> struct is_class { static constexpr bool value = false; }; } class MyClass { public: operator double() const { return 1; } template operator T() const { static_assert(std::is_class::value, "problem"); return T(); } }; template void SetValue(const MyClass& obj, T* value) { // erroneously dispatched to operator T when T is double *value = obj.operator T(); } int main() { MyClass obj; // works fine obj.operator double (); double x; // error, when operator T is called in SetValue SetValue(obj, &x); }