__builtin_va_*() and __builtin_ms_va_*() are declared as functions with a parameter of reference type. This patch fixes a crash when using these functions in C where an argument of structure type is incompatible with the parameter type. Differential Revision: https://reviews.llvm.org/D82805 Reviewed By: riccibruno Patch by: Aleksandr Platonov <platonov.aleksandr@huawei.com>
7 lines
302 B
C
7 lines
302 B
C
// RUN: %clang_cc1 -triple arm-unknown-gnu -fsyntax-only -verify %s
|
|
|
|
void f() {
|
|
struct EmptyStruct {};
|
|
struct EmptyStruct S;
|
|
__builtin_va_end(S); // no-crash, expected-error {{non-const lvalue reference to type '__builtin_va_list' cannot bind to a value of unrelated type 'struct EmptyStruct'}}
|
|
} |