| 1 |
// RUN: rm -fR %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
// RUN: cd %t |
| 4 |
// RUN: %clang_cc1 -verify -w -std=c++20 -fmodule-name=h1.h -emit-header-unit -xc++-user-header h1.h -o h1.pcm |
| 5 |
// RUN: %clang_cc1 -verify -w -std=c++20 -fmodule-map-file=module.modulemap -fmodule-file=h1.h=h1.pcm main.cpp -o main.o |
| 6 |
|
| 7 |
//--- module.modulemap |
| 8 |
module "h1.h" { |
| 9 |
header "h1.h" |
| 10 |
export * |
| 11 |
} |
| 12 |
|
| 13 |
//--- h0.h |
| 14 |
// expected-no-diagnostics |
| 15 |
#pragma once |
| 16 |
|
| 17 |
template <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 |
}; |
| 25 |
typedef A<float> packed_vec3; |
| 26 |
|
| 27 |
//--- h1.h |
| 28 |
// expected-no-diagnostics |
| 29 |
#pragma once |
| 30 |
|
| 31 |
#include "h0.h" |
| 32 |
|
| 33 |
constexpr packed_vec3 kMessThingsUp = packed_vec3(5.0f, 5.0f, 5.0f); |
| 34 |
|
| 35 |
//--- main.cpp |
| 36 |
// expected-no-diagnostics |
| 37 |
#include "h0.h" |
| 38 |
|
| 39 |
static_assert(sizeof(packed_vec3) == sizeof(float) * 3); |
| 40 |
static_assert(alignof(packed_vec3) == sizeof(float)); |
| 41 |
|
| 42 |
import "h1.h"; |
| 43 |
|
| 44 |
constexpr packed_vec3 kDefaultHalfExtents = packed_vec3(5.0f, 5.0f, 5.0f); |