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
diff --git a/test/SemaCXX/converting-constructor.cpp b/test/SemaCXX/converting-constructor.cpp
new file mode 100644
index 0000000..4bcd5aa
--- /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}}
+}
+