aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2014-02-03 20:07:55 +0100
committerMarc Glisse <glisse@gcc.gnu.org>2014-02-03 19:07:55 +0000
commit5d77fb196b3b6a2aabbb50ce6502a46078162f67 (patch)
treeab881259a5ba57d9b1f3a45c2e5aedcfb8af1dd0 /gcc/testsuite
parentf344f525193bd4e271ea50c5eb7a4e92c57dbc67 (diff)
downloadgcc-5d77fb196b3b6a2aabbb50ce6502a46078162f67.zip
gcc-5d77fb196b3b6a2aabbb50ce6502a46078162f67.tar.gz
gcc-5d77fb196b3b6a2aabbb50ce6502a46078162f67.tar.bz2
re PR c++/53017 (Integer constant expression not constant enough for vector_size)
2014-02-03 Marc Glisse <marc.glisse@inria.fr> PR c++/53017 PR c++/59211 gcc/c-family/ * c-common.c (handle_aligned_attribute, handle_alloc_size_attribute, handle_vector_size_attribute, handle_nonnull_attribute): Call default_conversion on the attribute argument. (handle_nonnull_attribute): Increment the argument number. gcc/cp/ * tree.c (handle_init_priority_attribute): Call default_conversion on the attribute argument. gcc/ * doc/extend.texi (Function Attributes): Typo. gcc/testsuite/ * c-c++-common/attributes-1.c: New testcase. * g++.dg/cpp0x/constexpr-attribute2.C: Likewise. From-SVN: r207436
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/c-c++-common/attributes-1.c23
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-attribute2.C32
3 files changed, 62 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8c7af49..b7c6252 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2014-02-03 Marc Glisse <marc.glisse@inria.fr>
+
+ PR c++/53017
+ PR c++/59211
+ * c-c++-common/attributes-1.c: New testcase.
+ * g++.dg/cpp0x/constexpr-attribute2.C: Likewise.
+
2014-02-03 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58871
diff --git a/gcc/testsuite/c-c++-common/attributes-1.c b/gcc/testsuite/c-c++-common/attributes-1.c
new file mode 100644
index 0000000..af4dd12
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attributes-1.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-prune-output "undeclared here \\(not in a function\\)|\[^\n\r\]* was not declared in this scope" } */
+
+void* my_calloc(unsigned, unsigned) __attribute__((alloc_size(1,bar))); /* { dg-warning "outside range" } */
+void* my_realloc(void*, unsigned) __attribute__((alloc_size(bar))); /* { dg-warning "outside range" } */
+
+typedef char vec __attribute__((vector_size(bar))); /* { dg-warning "ignored" } */
+
+void f1(char*) __attribute__((nonnull(bar))); /* { dg-error "invalid operand" } */
+void f2(char*) __attribute__((nonnull(1,bar))); /* { dg-error "invalid operand" } */
+
+void g() __attribute__((aligned(bar))); /* { dg-error "invalid value|not an integer" } */
+
+void foo(void);
+void* my_calloc(unsigned, unsigned) __attribute__((alloc_size(1,foo))); /* { dg-warning "outside range" } */
+void* my_realloc(void*, unsigned) __attribute__((alloc_size(foo))); /* { dg-warning "outside range" } */
+
+typedef char vec __attribute__((vector_size(foo))); /* { dg-warning "ignored" } */
+
+void f1(char*) __attribute__((nonnull(foo))); /* { dg-error "invalid operand" } */
+void f2(char*) __attribute__((nonnull(1,foo))); /* { dg-error "invalid operand" } */
+
+void g() __attribute__((aligned(foo))); /* { dg-error "invalid value|not an integer" } */
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute2.C
new file mode 100644
index 0000000..755188e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute2.C
@@ -0,0 +1,32 @@
+// { dg-options -std=gnu++11 }
+
+struct t { t(); };
+
+constexpr int prio = 123;
+constexpr int size = 8;
+constexpr int pos = 1;
+enum A { zero = 0, one, two };
+__attribute__((init_priority(prio))) t a;
+
+enum class E1 : int {
+ first = 101,
+ second,
+ third,
+};
+__attribute__((init_priority(E1::second))) t b; // Should not compile?
+
+enum E2 {
+ E2_first = 141,
+ E2_second,
+ E2_third,
+};
+__attribute__((init_priority(E2_second))) t c;
+
+void* my_calloc(unsigned, unsigned) __attribute__((alloc_size(pos,two)));
+void* my_realloc(void*, unsigned) __attribute__((alloc_size(two)));
+
+typedef char vec __attribute__((vector_size(size)));
+
+void f(char*) __attribute__((nonnull(pos)));
+
+void g() __attribute__((aligned(size)));