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
41 lines
2.1 KiB
C
41 lines
2.1 KiB
C
// RUN: %clang_cc1 -triple x86_64-pc-linux -verify=expected,array-type -std=c2y -Wall -pedantic -ffreestanding %s
|
|
// RUN: %clang_cc1 -triple aarch64-pc-win32 -verify=expected,char-ptr-type -std=c2y -Wall -pedantic -ffreestanding %s
|
|
|
|
/* WG14 N3363: Clang 5
|
|
* stdarg.h wording... v3
|
|
*
|
|
* Clarifies that va_start can only be used within a function body, and that
|
|
* the macros and functions require an lvalue of type va_list instead of an
|
|
* rvalue.
|
|
*
|
|
* Clang has diagnosed this correctly in all cases except va_copy since
|
|
* Clang 5. va_copy still needs to be updated to issue a diagnostic about use
|
|
* of an rvalue. However, our lack of a diagnostic is still conforming because
|
|
* a diagnostic is not required (it's not a constraint violation).
|
|
*/
|
|
|
|
#include <stdarg.h>
|
|
|
|
// The va_list argument given to every macro defined in this subclause shall be
|
|
// an lvalue of this type or the result of array-to-pointer decay of such an
|
|
// lvalue.
|
|
void f(int a, ...) {
|
|
va_list rvalue(); // array-type-error {{function cannot return array type 'va_list' (aka '__builtin_va_list')}}
|
|
va_start(rvalue()); // / char-ptr-type-error {{non-const lvalue reference to type '__builtin_va_list' cannot bind to a temporary of type 'va_list' (aka 'char *')}}
|
|
va_arg(rvalue(), int); // char-ptr-type-error {{expression is not assignable}}
|
|
// FIXME: this should get two diagnostics about use of a non-lvalue.
|
|
va_copy(rvalue(), rvalue()); // char-ptr-type-error {{non-const lvalue reference to type '__builtin_va_list' cannot bind to a temporary of type 'va_list' (aka 'char *')}}
|
|
va_end(rvalue()); // char-ptr-type-error {{non-const lvalue reference to type '__builtin_va_list' cannot bind to a temporary of type 'va_list' (aka 'char *')}}
|
|
}
|
|
|
|
// The va_start macro may only be invoked in the compound-statement of the body
|
|
// of a variadic function.
|
|
void g(va_list ap, int [(va_start(ap), 1)], ...) { // expected-error {{'va_start' cannot be used outside a function}}
|
|
va_end(ap);
|
|
}
|
|
|
|
va_list ap;
|
|
struct S {
|
|
int array[(va_start(ap), 1)]; // expected-error {{'va_start' cannot be used outside a function}}
|
|
};
|