]> git.tdb.fi Git - libs/core.git/commitdiff
Fix formatted output operator detection in lexicalcast.h
authorMikko Rasa <tdb@tdb.fi>
Mon, 3 Jun 2019 11:50:39 +0000 (14:50 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 3 Jun 2019 11:50:39 +0000 (14:50 +0300)
Since it was using a default-constructed value as part of the test
expression, it would fail to detect the operator for classes that are
not default-constructable.

source/strings/lexicalcast.h

index 6fe3cb366b24015ea215c127913db9f43ac42276..22b45e88c55eef60e433b6253d0070b77c9242a5 100644 (file)
@@ -97,7 +97,7 @@ struct CheckFormattedOutput: Sfinae
 {
        static std::ostream &s;
        template<typename T>
-       static Yes f(int (*)[sizeof(s<<T())]);
+       static Yes f(int (*)[sizeof(s<<reinterpret_cast<const T &>(s))]);
        using Sfinae::f;
 };