brintos

brintos / llvm-project-archived public Read only

0
0
Text · 567 B · bbb163a Raw
24 lines · c
1// RUN: %clang_cc1 -triple x86_64-linux %s -std=c2y -verify=expected,both -fexperimental-new-constant-interpreter2// RUN: %clang_cc1 -triple x86_64-linux %s -std=c2y -verify=ref,both3 4// both-no-diagnostics5 6struct S {7  int x;8  char c;9  float f;10};11 12#define DECL_BUFFER(Ty, Name) alignas(Ty) unsigned char Name[sizeof(Ty)]13 14struct T {15  DECL_BUFFER(struct S, buffer);16};17 18int quorble() {19  DECL_BUFFER(struct T, buffer);20  ((struct S *)((struct T *)buffer)->buffer)->x = 12;21  const struct S *s_ptr = (struct S *)((struct T *)buffer)->buffer;22  return s_ptr->x;23}24