instantiate-attr.cpp 820 B

123456789101112131415161718192021222324252627282930313233343536
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s
  2. // expected-no-diagnostics
  3. template <typename T>
  4. struct A {
  5. char a __attribute__((aligned(16)));
  6. struct B {
  7. typedef T __attribute__((aligned(16))) i16;
  8. i16 x;
  9. };
  10. };
  11. int a[sizeof(A<int>) == 16 ? 1 : -1];
  12. int a2[sizeof(A<int>::B) == 16 ? 1 : -1];
  13. // rdar://problem/8243419
  14. namespace test1 {
  15. template <typename T> struct A {
  16. int a;
  17. T b[0];
  18. } __attribute__((packed));
  19. typedef A<unsigned long> type;
  20. int test0[sizeof(type) == 4 ? 1 : -1];
  21. int test1[__builtin_offsetof(type, a) == 0 ? 1 : -1];
  22. int test2[__builtin_offsetof(type, b) == 4 ? 1 : -1];
  23. }
  24. namespace test2 {
  25. template <class type>
  26. struct fastscriptmember {
  27. type Member __attribute__ ((packed));
  28. char x;
  29. };
  30. int test0[sizeof(fastscriptmember<int>) == 5 ? 1 : -1];
  31. }