[module.import/6] last sentence: A header unit shall not contain a definition of a non-inline function or variable whose name has external linkage. Differential Revision: https://reviews.llvm.org/D140261
25 lines
595 B
C++
25 lines
595 B
C++
// RUN: mkdir -p %t
|
|
// RUN: split-file %s %t
|
|
|
|
// RUN: %clang_cc1 -std=c++20 -x c++-header %t/bad-header-unit.h \
|
|
// RUN: -emit-header-unit -o %t/bad-header-unit.pcm -verify
|
|
|
|
//--- bad-header-unit.h
|
|
|
|
inline int ok_foo () { return 0;}
|
|
|
|
static int ok_bar ();
|
|
|
|
int ok_decl ();
|
|
|
|
int bad_def () { return 2;} // expected-error {{non-inline external definitions are not permitted in C++ header units}}
|
|
|
|
inline int ok_inline_var = 1;
|
|
|
|
static int ok_static_var;
|
|
|
|
int ok_var_decl;
|
|
|
|
int bad_var_definition = 3; // expected-error {{non-inline external definitions are not permitted in C++ header units}}
|
|
|