Created
October 31, 2015 22:13
-
-
Save am11/f89618eb3110f18ae320 to your computer and use it in GitHub Desktop.
Overload resolution bug repro in VS2015 RTM (gathered from Stephan T. Lavavej aka STL)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Discussion: https://github.com/Snaipe/Criterion/issues/51 | |
namespace Std { | |
template <class Elem> struct CharTraits { }; | |
template <class Elem, class Traits = CharTraits<Elem>> struct BasicOstream { | |
void operator<<(const void *) = delete; | |
}; | |
template <class Traits> void operator<<(BasicOstream<char, Traits>&, const char *) = delete; | |
} | |
template <typename CharT> struct MyOstream : Std::BasicOstream<char> { }; | |
MyOstream<char> * stream; | |
#ifdef AVOID_TEMPLATE | |
MyOstream<char>& call() { | |
#else | |
template <typename RandomT = double> MyOstream<char>& call() { | |
#endif | |
stream = new MyOstream<char>(); | |
return *stream; | |
} | |
int main() { | |
MyOstream<char>& f = call(); | |
f << "Foo"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment