aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/converting-constructor.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-01-14 18:02:48 +0000
committerDouglas Gregor <dgregor@apple.com>2009-01-14 18:02:48 +0000
commitbf985f1fccd1ff5a686b79e0c6aeb5004eac33f3 (patch)
tree616f9da7fdff1267db4d93820b657909910c301d /test/SemaCXX/converting-constructor.cpp
parent09f41cf63f4df0bf4e98ee473e44e9a95b68f0ff (diff)
Test explicit constructor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62237 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/converting-constructor.cpp')
-rw-r--r--test/SemaCXX/converting-constructor.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/SemaCXX/converting-constructor.cpp b/test/SemaCXX/converting-constructor.cpp
index b99a134328..0ab8d93137 100644
--- a/test/SemaCXX/converting-constructor.cpp
+++ b/test/SemaCXX/converting-constructor.cpp
@@ -21,3 +21,20 @@ void g(short s, Y y, Z z) {
f(z); // expected-error{{incompatible type passing 'class Z', expected 'class X'}}
}
+
+class FromShort {
+public:
+ FromShort(short s);
+};
+
+class FromShortExplicitly {
+public:
+ explicit FromShortExplicitly(short s);
+};
+
+void explicit_constructor(short s) {
+ FromShort fs1(s);
+ FromShort fs2 = s;
+ FromShortExplicitly fse1(s);
+ FromShortExplicitly fse2 = s; // expected-error{{error: cannot initialize 'fse2' with an lvalue of type 'short'}}
+}