FYI Once the bots finish checking this commit I'm going to merge this into the 4.0 branch.
This fixes a very recently introduced regression. /Eric On Tue, Jan 17, 2017 at 4:41 PM, Eric Fiselier via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: ericwf > Date: Tue Jan 17 17:41:42 2017 > New Revision: 292294 > > URL: http://llvm.org/viewvc/llvm-project?rev=292294&view=rev > Log: > Fix type_info's constructor by making it explicit again. > > In recent changes type_info's private constructor was > accidentally made implicit. This patch fixes that. > > Modified: > libcxx/trunk/include/typeinfo > libcxx/trunk/test/std/language.support/support.rtti/ > type.info/type_info.pass.cpp > > Modified: libcxx/trunk/include/typeinfo > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ > typeinfo?rev=292294&r1=292293&r2=292294&view=diff > ============================================================ > ================== > --- libcxx/trunk/include/typeinfo (original) > +++ libcxx/trunk/include/typeinfo Tue Jan 17 17:41:42 2017 > @@ -95,12 +95,13 @@ protected: > uintptr_t __type_name; > > _LIBCPP_INLINE_VISIBILITY > - type_info(const char* __n) : > __type_name(reinterpret_cast<uintptr_t>(__n)) > {} > + explicit type_info(const char* __n) > + : __type_name(reinterpret_cast<uintptr_t>(__n)) {} > #else > const char *__type_name; > > _LIBCPP_INLINE_VISIBILITY > - type_info(const char* __n) : __type_name(__n) {} > + explicit type_info(const char* __n) : __type_name(__n) {} > #endif > > public: > > Modified: libcxx/trunk/test/std/language.support/support.rtti/ > type.info/type_info.pass.cpp > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/ > language.support/support.rtti/type.info/type_info.pass.cpp? > rev=292294&r1=292293&r2=292294&view=diff > ============================================================ > ================== > --- libcxx/trunk/test/std/language.support/support.rtti/ > type.info/type_info.pass.cpp (original) > +++ libcxx/trunk/test/std/language.support/support.rtti/ > type.info/type_info.pass.cpp Tue Jan 17 17:41:42 2017 > @@ -10,11 +10,16 @@ > // test type_info > > #include <typeinfo> > +#include <string> > #include <cstring> > #include <cassert> > > +bool test_constructor_explicit(std::type_info const&) { return false; } > +bool test_constructor_explicit(std::string const&) { return true; } > + > int main() > { > + { > const std::type_info& t1 = typeid(int); > const std::type_info& t2 = typeid(int); > assert(t1 == t2); > @@ -23,4 +28,13 @@ int main() > assert(!t1.before(t2)); > assert(strcmp(t1.name(), t2.name()) == 0); > assert(strcmp(t1.name(), t3.name()) != 0); > + } > + { > + // type_info has a protected constructor taking a string literal. This > + // constructor is not intended for users. However it still > participates > + // in overload resolution, so we need to ensure that it is marked > explicit > + // to avoid ambiguous conversions. > + // See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216201 > + assert(test_constructor_explicit("abc")); > + } > } > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits