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 | c28b57d70346c1844ef8d7ba233c5c1f94ab6677 (patch) | |
tree | 5a53a083d2ab170421f13d569c9728e911beddb4 /clang/test/SemaCXX/direct-initializer.cpp | |
parent | 6692dec2a0ff6ad5618d8aa49f0c6fab846d6ad1 (diff) | |
download | bcm5719-llvm-c28b57d70346c1844ef8d7ba233c5c1f94ab6677.tar.gz bcm5719-llvm-c28b57d70346c1844ef8d7ba233c5c1f94ab6677.zip |
Implicit support for direct initialization of objects of class type, e.g.,
X x(5, 7);
llvm-svn: 58641
Diffstat (limited to 'clang/test/SemaCXX/direct-initializer.cpp')
-rw-r--r-- | clang/test/SemaCXX/direct-initializer.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/direct-initializer.cpp b/clang/test/SemaCXX/direct-initializer.cpp index c756e473dd4..952e1322999 100644 --- a/clang/test/SemaCXX/direct-initializer.cpp +++ b/clang/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:}} +} |