summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/conversion-function.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-24 20:54:38 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-24 20:54:38 +0000
commitc779e995402ac3e6dc10655482b5e0be34dfa23f (patch)
treed144914954dc08e882c1996caac33e8777ab1656 /clang/test/SemaCXX/conversion-function.cpp
parentcfc12ddb0a61688d66d28c4c7f4ee7aa95abec6f (diff)
downloadbcm5719-llvm-c779e995402ac3e6dc10655482b5e0be34dfa23f.tar.gz
bcm5719-llvm-c779e995402ac3e6dc10655482b5e0be34dfa23f.zip
When we are performing copy initialization of a class type via its
copy constructor, suppress user-defined conversions on the argument. Otherwise, we can end up in a recursion loop where the bind the argument of the copy constructor to another copy constructor call, whose argument is then a copy constructor call... Found by Boost.Regex which, alas, still isn't building. llvm-svn: 102269
Diffstat (limited to 'clang/test/SemaCXX/conversion-function.cpp')
-rw-r--r--clang/test/SemaCXX/conversion-function.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/conversion-function.cpp b/clang/test/SemaCXX/conversion-function.cpp
index dfc06506419..3e96d02495f 100644
--- a/clang/test/SemaCXX/conversion-function.cpp
+++ b/clang/test/SemaCXX/conversion-function.cpp
@@ -56,7 +56,7 @@ public:
// This used to crash Clang.
struct Flip;
-struct Flop { // expected-note{{candidate is the implicit copy constructor}}
+struct Flop {
Flop();
Flop(const Flip&); // expected-note{{candidate constructor}}
};
@@ -202,3 +202,16 @@ namespace smart_ptr {
return X(Y());
}
}
+
+struct Any {
+ Any(...);
+};
+
+struct Other {
+ Other(const Other &);
+ Other();
+};
+
+void test_any() {
+ Any any = Other(); // expected-error{{cannot pass object of non-POD type 'Other' through variadic constructor; call will abort at runtime}}
+}
OpenPOWER on IntegriCloud