CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
57 lines
2.7 KiB
C
57 lines
2.7 KiB
C
// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -pedantic %s
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -pedantic %s -fexperimental-new-constant-interpreter
|
|
// REQUIRES: LP64
|
|
|
|
struct foo { int a, b; };
|
|
|
|
static struct foo t = (struct foo){0,0};
|
|
static struct foo t1 = __builtin_choose_expr(0, (struct foo){0,0}, (struct foo){0,0});
|
|
static struct foo t2 = {0,0};
|
|
static struct foo t3 = t2; // expected-error {{initializer element is not a compile-time constant}}
|
|
static int *p = (int []){2,4};
|
|
static int x = (int){1};
|
|
|
|
static int *p2 = (int []){2,x}; // expected-error {{initializer element is not a compile-time constant}}
|
|
static long *p3 = (long []){2,"x"}; // expected-error {{incompatible pointer to integer conversion initializing 'long' with an expression of type 'char[2]'}}
|
|
|
|
typedef struct { } cache_t; // expected-warning{{empty struct is a GNU extension}}
|
|
static cache_t clo_I1_cache = ((cache_t) { } ); // expected-warning{{use of an empty initializer is a C23 extension}}
|
|
|
|
typedef struct Test {int a;int b;} Test;
|
|
static Test* ll = &(Test) {0,0};
|
|
|
|
extern void fooFunc(struct foo *pfoo);
|
|
|
|
int main(int argc, char **argv) {
|
|
int *l = (int []){x, *p, *p2};
|
|
fooFunc(&(struct foo){ 1, 2 });
|
|
}
|
|
|
|
struct Incomplete; // expected-note{{forward declaration of 'struct Incomplete'}}
|
|
struct Incomplete* I1 = &(struct Incomplete){1, 2, 3}; // expected-error {{variable has incomplete type}}
|
|
void IncompleteFunc(unsigned x) {
|
|
struct Incomplete* I2 = (struct foo[x]){1, 2, 3}; // expected-error {{compound literal cannot be of variable-length array type}}
|
|
(void){1,2,3}; // expected-error {{variable has incomplete type}}
|
|
(void(void)) { 0 }; // expected-error{{illegal initializer type 'void (void)'}}
|
|
}
|
|
|
|
// PR6080
|
|
int array[(sizeof(int[3]) == sizeof( (int[]) {0,1,2} )) ? 1 : -1];
|
|
|
|
// Constant restriction should not apply to compound literals in blocks
|
|
int (^block)(int) = ^(int i) {
|
|
int *array = (int[]) {i, i + 2, i + 4};
|
|
return array[i];
|
|
};
|
|
|
|
// C99 6.5.2.5 Compound literals constraint 1: The type name shall specify an object type or an array of unknown size, but not a variable length array type.
|
|
// So check that VLA type compound literals are rejected (see https://github.com/llvm/llvm-project/issues/89835).
|
|
void vla(int n) {
|
|
int size = 5;
|
|
(void)(int[size]){}; // expected-warning {{use of an empty initializer is a C23 extension}}
|
|
// expected-error@-1 {{compound literal cannot be of variable-length array type}}
|
|
(void)(int[size]){1}; // expected-error {{compound literal cannot be of variable-length array type}}
|
|
(void)(int[size]){1,2,3}; // expected-error {{compound literal cannot be of variable-length array type}}
|
|
(void)(int[size]){1,2,3,4,5}; // expected-error {{compound literal cannot be of variable-length array type}}
|
|
}
|