summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/gen-attrs-47.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/gen-attrs-47.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-47.C13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-47.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-47.C
new file mode 100644
index 0000000000..af74abd186
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-47.C
@@ -0,0 +1,13 @@
+// { dg-do compile { target c++11 } }
+// Example taken from dcl.attr.grammar:
+
+int p[10];
+void f()
+{
+ int x = 42, y[5];
+ /* Here, the '[[' should have introduced an attribute, on a
+ lambda invocation an array subscripting expression. */
+ int(p[[x] { return x; }()]); // { dg-error "expected|consecutive" }
+ /* Likewise, the '[[gnu::' is invalid here. */
+ y[[] { return 2; }()] = 2; // { dg-error "expected|consecutive" }
+}