Files
TheRock/compiler/amd-llvm/clang/test/SemaCXX/c99.cpp
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

71 lines
2.3 KiB
C++

// RUN: %clang_cc1 -fsyntax-only -pedantic -verify=expected,cxx17 -std=c++17 %s
// RUN: %clang_cc1 -fsyntax-only -pedantic -verify=expected,cxx20 -std=c++2a %s
// cxx17-warning@* 0+{{designated initializers are a C++20 extension}}
void f1(int i[static 5]) { // expected-error{{C99}}
}
struct Point { int x; int y; int z[]; }; // expected-warning{{flexible array members are a C99 feature}}
Point p1 = { .x = 17,
y: 25 }; // expected-warning{{use of GNU old-style field designator extension}}
Point p2 = {
.x = 17, // expected-warning {{mixture of designated and non-designated initializers in the same initializer list is a C99 extension}}
25 // expected-note {{first non-designated initializer}}
};
Point p3 = {
.x = 17, // expected-note {{previous initialization is here}}
.x = 18, // expected-warning {{initializer overrides prior initialization of this subobject}}
};
Point p4 = {
.x = 17, // expected-warning {{mixture of designated and non-designated initializers in the same initializer list is a C99 extension}}
25, // expected-note {{first non-designated initializer}}
// expected-note@-1 {{previous initialization is here}}
.y = 18, // expected-warning {{initializer overrides prior initialization of this subobject}}
};
int arr[1] = {[0] = 0}; // expected-warning {{array designators are a C99 extension}}
struct Pt { int x, y; };
struct Rect { Pt tl, br; };
Rect r = {
.tl.x = 0 // expected-warning {{nested designators are a C99 extension}}
};
struct NonTrivial {
NonTrivial();
~NonTrivial();
};
struct S {
int a;
NonTrivial b;
};
struct T {
S s;
};
S f();
T t1 = {
.s = f()
};
// It's important that we reject this; we would not destroy the existing
// 'NonTrivial' object before overwriting it (and even calling its destructor
// would not necessarily be correct).
T t2 = {
.s = f(), // expected-note {{previous}}
.s.b = NonTrivial() // expected-error {{initializer would partially override prior initialization of object of type 'S' with non-trivial destruction}}
// expected-warning@-1 {{nested}}
};
// FIXME: It might be reasonable to accept this.
T t3 = {
.s = f(), // expected-note {{previous}}
.s.a = 0 // expected-error {{initializer would partially override prior initialization of object of type 'S' with non-trivial destruction}}
// expected-warning@-1 {{nested}}
};