Clang Project

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