This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C,C++] integer constants in attribute arguments


Marc Glisse <marc.glisse@inria.fr> writes:

> Index: gcc/testsuite/g++.dg/cpp0x/constexpr-attribute2.C
> ===================================================================
> --- gcc/testsuite/g++.dg/cpp0x/constexpr-attribute2.C	(revision 0)
> +++ gcc/testsuite/g++.dg/cpp0x/constexpr-attribute2.C	(working copy)
> @@ -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)));

/usr/local/gcc/gcc-20140204/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute2.C:32:6: error: alignment for 'void g()' must be at least 16

FAIL: g++.dg/cpp0x/constexpr-attribute2.C (test for excess errors)

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]