summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/explicit5.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/explicit5.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/explicit5.C25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/explicit5.C b/gcc/testsuite/g++.dg/cpp0x/explicit5.C
new file mode 100644
index 000000000..88a47071d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/explicit5.C
@@ -0,0 +1,25 @@
+// test for extension of DR 899 to handle template ctors
+// { dg-options "-std=c++0x" }
+// { dg-do run }
+
+int r = 1;
+
+struct C {
+ C() { }
+ template <class T = int> C(C&, T = 0) { r = 0; }
+};
+
+C c;
+
+struct A
+{
+ explicit operator C&() const { return c; }
+};
+
+int main()
+{
+ A a;
+ C c2 (a);
+
+ return r;
+}