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
45 lines
2.7 KiB
C
45 lines
2.7 KiB
C
// RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic %s
|
|
|
|
/* WG14 N3348: No
|
|
* Matching of Multi-Dimensional Arrays in Generic Selection Expressions
|
|
*
|
|
* This allows use of * in a _Generic association as a placeholder for any size
|
|
* value.
|
|
*
|
|
* FIXME: Clang doesn't yet implement this paper. When we do implement it, we
|
|
* should expose the functionality in earlier language modes (C89) for
|
|
* compatibility with GCC.
|
|
*/
|
|
|
|
void test(int n, int m) {
|
|
static_assert(1 == _Generic(int[3][2], int[3][*]: 1, int[2][*]: 0)); /* expected-error {{star modifier used outside of function prototype}}
|
|
expected-error {{array has incomplete element type 'int[]'}}
|
|
*/
|
|
static_assert(1 == _Generic(int[3][2], int[*][2]: 1, int[*][3]: 0)); // expected-error {{star modifier used outside of function prototype}}
|
|
static_assert(1 == _Generic(int[3][n], int[3][*]: 1, int[2][*]: 0)); /* expected-error {{star modifier used outside of function prototype}}
|
|
expected-error {{array has incomplete element type 'int[]'}}
|
|
*/
|
|
static_assert(1 == _Generic(int[n][m], int[*][*]: 1, char[*][*]: 0)); /* expected-error 2 {{star modifier used outside of function prototype}}
|
|
expected-error {{array has incomplete element type 'int[]'}}
|
|
*/
|
|
static_assert(1 == _Generic(int(*)[2], int(*)[*]: 1)); // expected-error {{star modifier used outside of function prototype}}
|
|
}
|
|
|
|
void questionable() {
|
|
// GCC accepts this despite the * appearing outside of a generic association,
|
|
// but it's not clear whether that's intentionally supported or an oversight.
|
|
// It gives a warning about * being used outside of a declaration, but not
|
|
// with an associated warning group.
|
|
static_assert(1 == _Generic(int[*][*], int[2][100]: 1)); /* expected-error 2 {{star modifier used outside of function prototype}}
|
|
expected-error {{array has incomplete element type 'int[]'}}
|
|
*/
|
|
// GCC claims this matches multiple associations, so the functionality seems
|
|
// like it may be intended to work?
|
|
(void)_Generic(int[*][*], /* expected-error 2 {{star modifier used outside of function prototype}}
|
|
expected-error {{array has incomplete element type 'int[]'}}
|
|
*/
|
|
int[2][100]: 1,
|
|
int[3][1000]: 2,
|
|
);
|
|
}
|