brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 95b92e8 Raw
26 lines · c
1// RUN: %clang_cc1 -verify=good -pedantic -Wall -std=c2y %s2// RUN: %clang_cc1 -verify=compat,expected -pedantic -Wall -Wpre-c2y-compat -std=c2y %s3// RUN: %clang_cc1 -verify=ped,expected -pedantic -Wall -std=c23 %s4// RUN: %clang_cc1 -verify=ped,expected -pedantic -Wall -std=c17 %s5// good-no-diagnostics6 7/* WG14 N3622: Clang 228 * Allow calling static inline within extern inline9 *10 * This verifies that a constraint from previous standards is no longer11 * triggered in C2y mode. The constraint is with calling a static function12 * or using a static variable from an inline function with external linkage.13 */14 15static void static_func(void) {} // expected-note {{declared here}}16static int static_var;           // expected-note {{declared here}}17 18extern inline void test(void) {19  static_func();   /* ped-warning {{using static function 'static_func' in an inline function with external linkage is a C2y extension}}20                      compat-warning {{using static function 'static_func' in an inline function with external linkage is incompatible with standards before C2y}}21                    */22  static_var = 12; /* ped-warning {{using static variable 'static_var' in an inline function with external linkage is a C2y extension}}23                      compat-warning {{using static variable 'static_var' in an inline function with external linkage is incompatible with standards before C2y}}24                    */25}26