summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/fail21547.d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gdc.test/fail_compilation/fail21547.d')
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail21547.d34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail21547.d b/gcc/testsuite/gdc.test/fail_compilation/fail21547.d
new file mode 100644
index 00000000000..7a6a44a4a13
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail21547.d
@@ -0,0 +1,34 @@
+// https://issues.dlang.org/show_bug.cgi?id=21547
+
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail21547.d(32): Error: struct `Bar` has constructors, cannot use `{ initializers }`, use `Bar( initializers )` instead
+fail_compilation/fail21547.d(33): Error: struct `Bar1` has constructors, cannot use `{ initializers }`, use `Bar1( initializers )` instead
+---
+*/
+
+struct Bar
+{
+ @disable this(int a) {}
+ this(int a, int b) {}
+
+ string a;
+ uint b;
+}
+
+struct Bar1
+{
+ @disable this(int a) {}
+ this(const ref Bar1 o) {}
+ this(int a, int b) {}
+
+ string a;
+ uint b;
+}
+
+void main ()
+{
+ Bar b = { a: "Hello", b: 42 };
+ Bar1 b1 = { a: "Hello", b: 42 };
+}