Skip to content
Open
4 changes: 4 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ Improvements to Clang's diagnostics
- Clang now emits a diagnostic in case `vector_size` or `ext_vector_type`
attributes are used with a negative size (#GH165463).

- The warning about static local variables declared inside `inline`
functions is now correctly converted to an error if `-pedantic-errors` is
passed (#GH39524).

Improvements to Clang's time-trace
----------------------------------

Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -6339,7 +6339,7 @@ def warn_c2y_compat_internal_in_extern_inline : Warning<
"using static %select{function|variable}0 %1 in an inline function with "
"external linkage is incompatible with standards before C2y">,
InGroup<CPre2yCompat>, DefaultIgnore;
def warn_static_local_in_extern_inline : Warning<
def warn_static_local_in_extern_inline : ExtWarn<
"non-constant static local variable in inline function may be different "
"in different files">, InGroup<StaticLocalInInline>;
def note_convert_inline_to_static : Note<
Expand Down
6 changes: 6 additions & 0 deletions clang/test/Sema/inline-static-var.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: %clang_cc1 -std=c11 -pedantic-errors -verify %s

inline void f(void) { // expected-note {{use 'static' to give inline function 'f' internal linkage}}
static int x; // expected-error {{non-constant static local variable in inline function may be different in different files}}
}

Loading