brintos

brintos / llvm-project-archived public Read only

0
0
Text · 973 B · 8ff20f2 Raw
45 lines · cpp
1// RUN: rm -fR %t2// RUN: split-file %s %t3// RUN: cd %t4// RUN: %clang_cc1 -verify -w -std=c++20 -fmodule-name=h1.h -emit-header-unit -xc++-user-header h1.h -o h1.pcm5// RUN: %clang_cc1 -verify -w -std=c++20 -fmodule-map-file=module.modulemap -fmodule-file=h1.h=h1.pcm main.cpp -o main.o6 7//--- module.modulemap8module "h1.h" {9  header "h1.h"10  export *11}12 13//--- h0.h14// expected-no-diagnostics15#pragma once16 17template <typename T> struct A {18  union {19    struct {20      T x, y, z;21    };22  };23  constexpr A(T, T, T) : x(), y(), z() {}24};25typedef A<float> packed_vec3;26 27//--- h1.h28// expected-no-diagnostics29#pragma once30 31#include "h0.h"32 33constexpr packed_vec3 kMessThingsUp = packed_vec3(5.0f, 5.0f, 5.0f);34 35//--- main.cpp36// expected-no-diagnostics37#include "h0.h"38 39static_assert(sizeof(packed_vec3) == sizeof(float) * 3);40static_assert(alignof(packed_vec3) == sizeof(float));41 42import "h1.h";43 44constexpr packed_vec3 kDefaultHalfExtents = packed_vec3(5.0f, 5.0f, 5.0f);45