summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/explicit.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-01-24 17:15:04 +0000
committerAnders Carlsson <andersca@mac.com>2010-01-24 17:15:04 +0000
commit6515d877c0f32d143edd7565e4d10f0e0f3f41e2 (patch)
tree80b4507d54fc5427b60176b3d0b8a264044feef7 /clang/test/SemaCXX/explicit.cpp
parent77babdb99a99cfe4095d81b72e4bfd304e65ebc7 (diff)
downloadbcm5719-llvm-6515d877c0f32d143edd7565e4d10f0e0f3f41e2.tar.gz
bcm5719-llvm-6515d877c0f32d143edd7565e4d10f0e0f3f41e2.zip
Fix a pretty bad bug where if a constructor (or conversion function) was marked as 'explicit', but then defined out-of-line, we would not treat it as being explicit.
llvm-svn: 94366
Diffstat (limited to 'clang/test/SemaCXX/explicit.cpp')
-rw-r--r--clang/test/SemaCXX/explicit.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/explicit.cpp b/clang/test/SemaCXX/explicit.cpp
new file mode 100644
index 00000000000..717ed1e3caf
--- /dev/null
+++ b/clang/test/SemaCXX/explicit.cpp
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+namespace Constructor {
+struct A {
+ A(int);
+};
+
+struct B {
+ explicit B(int);
+};
+
+B::B(int) { }
+
+struct C {
+ void f(const A&);
+ void f(const B&);
+};
+
+void f(C c) {
+ c.f(10);
+}
+}
+
+namespace Conversion {
+ struct A {
+ operator int();
+ explicit operator bool();
+ };
+
+ A::operator bool() { return false; }
+
+ struct B {
+ void f(int);
+ void f(bool);
+ };
+
+ void f(A a, B b) {
+ b.f(a);
+ }
+}
OpenPOWER on IntegriCloud