summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/language.support
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-01-17 23:41:42 +0000
committerEric Fiselier <eric@efcs.ca>2017-01-17 23:41:42 +0000
commit6880885fae658c2cb2c6573c3df5899bc4c14160 (patch)
tree2956c44b2235398a3dbfd39dacf4e76c546234fe /libcxx/test/std/language.support
parentc3f87f02b1a433428353e2599e7b08be4a716418 (diff)
downloadbcm5719-llvm-6880885fae658c2cb2c6573c3df5899bc4c14160.tar.gz
bcm5719-llvm-6880885fae658c2cb2c6573c3df5899bc4c14160.zip
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. llvm-svn: 292294
Diffstat (limited to 'libcxx/test/std/language.support')
-rw-r--r--libcxx/test/std/language.support/support.rtti/type.info/type_info.pass.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/libcxx/test/std/language.support/support.rtti/type.info/type_info.pass.cpp b/libcxx/test/std/language.support/support.rtti/type.info/type_info.pass.cpp
index 2616865e6da..74c1c0c7df9 100644
--- a/libcxx/test/std/language.support/support.rtti/type.info/type_info.pass.cpp
+++ b/libcxx/test/std/language.support/support.rtti/type.info/type_info.pass.cpp
@@ -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"));
+ }
}
OpenPOWER on IntegriCloud