llvm-project/clang/test/CodeGen/ms_struct-long-double.c
Martin Storsjo 87c2ad29ee [RecordLayout] Only assert that fundamental type sizes are power of two on MSVC
Make types with sizes that aren't a power of two an error (that can
be disabled) in structs with ms_struct layout, except on mingw where
the situation is quite likely to occur and GCC handles it silently.

Differential Revision: https://reviews.llvm.org/D43908

llvm-svn: 326476
2018-03-01 20:22:57 +00:00

18 lines
761 B
C

// RUN: %clang_cc1 -emit-llvm-only -triple i686-windows-gnu -fdump-record-layouts %s | FileCheck %s
// RUN: %clang_cc1 -emit-llvm-only -triple i686-linux -fdump-record-layouts -Wno-incompatible-ms-struct %s | FileCheck %s
// RUN: not %clang_cc1 -emit-llvm-only -triple i686-linux -fdump-record-layouts %s 2>&1 | FileCheck %s -check-prefix=ERROR
struct ldb_struct {
char c;
long double ldb;
} __attribute__((__ms_struct__));
struct ldb_struct a;
// CHECK: 0 | struct ldb_struct
// CHECK-NEXT: 0 | char c
// CHECK-NEXT: 4 | long double ldb
// CHECK-NEXT: | [sizeof=16, align=4]
// ERROR: error: ms_struct may not produce Microsoft-compatible layouts with fundamental data types with sizes that aren't a power of two