array-to-pointer-decay.cpp 521 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s
  2. // expected-no-diagnostics
  3. struct mystruct {
  4. int member;
  5. };
  6. template <int i>
  7. int foo() {
  8. mystruct s[1];
  9. return s->member;
  10. }
  11. int main() {
  12. foo<1>();
  13. }
  14. // PR7405
  15. struct hb_sanitize_context_t {
  16. int start;
  17. };
  18. template <typename Type> static bool sanitize() {
  19. hb_sanitize_context_t c[1];
  20. return !c->start;
  21. }
  22. bool closure = sanitize<int>();
  23. // PR16206
  24. typedef struct {
  25. char x[4];
  26. } chars;
  27. chars getChars();
  28. void use(char *);
  29. void test() {
  30. use(getChars().x);
  31. }