[cfe-commits] r62237 - /cfe/trunk/test/SemaCXX/converting-constructor.cpp
Douglas Gregor
dgregor at apple.com
Wed Jan 14 10:02:48 PST 2009
Author: dgregor
Date: Wed Jan 14 12:02:48 2009
New Revision: 62237
URL: http://llvm.org/viewvc/llvm-project?rev=62237&view=rev
Log:
Test explicit constructor
Modified:
cfe/trunk/test/SemaCXX/converting-constructor.cpp
Modified: cfe/trunk/test/SemaCXX/converting-constructor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/converting-constructor.cpp?rev=62237&r1=62236&r2=62237&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/converting-constructor.cpp (original)
+++ cfe/trunk/test/SemaCXX/converting-constructor.cpp Wed Jan 14 12:02:48 2009
@@ -21,3 +21,20 @@
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'}}
+}
More information about the cfe-commits
mailing list