diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-11-03 20:45:27 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-11-03 20:45:27 +0000 |
commit | 18fe56863be253a27b940022d27a3101778adaf6 (patch) | |
tree | b2cf207b1ee2380ade5236d92c0e9758090f2946 /test/SemaCXX/direct-initializer.cpp | |
parent | 4fd7ffe4c990357cec0c74f216cacc9825e46048 (diff) |
Implicit support for direct initialization of objects of class type, e.g.,
X x(5, 7);
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58641 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/direct-initializer.cpp')
-rw-r--r-- | test/SemaCXX/direct-initializer.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/SemaCXX/direct-initializer.cpp b/test/SemaCXX/direct-initializer.cpp index c756e473dd..952e132299 100644 --- a/test/SemaCXX/direct-initializer.cpp +++ b/test/SemaCXX/direct-initializer.cpp @@ -8,3 +8,29 @@ void f() { int (x2)(1); // expected-warning {{statement was disambiguated as declaration}} for (int x(1);;) {} } + +class Y { + explicit Y(float); +}; + +class X { // expected-note{{candidate function}} +public: + explicit X(int); // expected-note{{candidate function}} + X(float, float, float); // expected-note{{candidate function}} + X(float, Y); // expected-note{{candidate function}} +}; + +class Z { // expected-note{{candidate function}} +public: + Z(int); // expected-note{{candidate function}} +}; + +void g() { + X x1(5); + X x2(1.0, 3, 4.2); + X x3(1.0, 1.0); // expected-error{{no matching constructor for initialization of 'x3'; candidates are:}} + Y y(1.0); + X x4(3.14, y); + + Z z; // expected-error{{no matching constructor for initialization of 'z'; candidates are:}} +} |