aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/converting-constructor.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-10-31 16:23:19 +0000
committerDouglas Gregor <dgregor@apple.com>2008-10-31 16:23:19 +0000
commit60d62c29d260596454aaf4cb50cbc756ac08875e (patch)
tree99e278d0d8857abebabc6bedfcf4db43d83cf6f2 /test/SemaCXX/converting-constructor.cpp
parent6a3615c90e654fce94e9cf635fb4021d5c40743e (diff)
Implement basic support for converting constructors in user-defined
conversions. Notes: - Overload resolution for converting constructors need to prohibit user-defined conversions (hence, the test isn't -verify safe yet). - We still use hacks for conversions from a class type to itself. This will be the case until we start implicitly declaring the appropriate special member functions. (That's next on my list) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58513 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/converting-constructor.cpp')
-rw-r--r--test/SemaCXX/converting-constructor.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/SemaCXX/converting-constructor.cpp b/test/SemaCXX/converting-constructor.cpp
new file mode 100644
index 0000000000..4bcd5aa01e
--- /dev/null
+++ b/test/SemaCXX/converting-constructor.cpp
@@ -0,0 +1,23 @@
+// RUN: clang -fsyntax-only %s
+class Z { };
+
+class Y {
+public:
+ Y(const Z&);
+};
+
+class X {
+public:
+ X(int);
+ X(const Y&);
+};
+
+void f(X);
+
+void g(short s, Y y, Z z) {
+ f(s);
+ f(1.0f);
+ f(y);
+ f(z); // expected-error{{incompatible}}
+}
+