2 // RUN: split-file %s %t
4 // RUN: %clang_cc1 -std=c++20 -x c++-header %t/bad-header-unit.h \
5 // RUN: -emit-header-unit -o %t/bad-header-unit.pcm -verify
7 //--- bad-header-unit.h
9 inline int ok_foo () { return 0;}
15 int bad_def () { return 2;} // expected-error {{non-inline external definitions are not permitted in C++ header units}}
17 inline int ok_inline_var
= 1;
19 static int ok_static_var
;
23 int bad_var_definition
= 3; // expected-error {{non-inline external definitions are not permitted in C++ header units}}
25 /* The cases below should compile without diagnostics. */
29 // This is a declaration instead of definition.
30 static const int value
= 43;
33 void deleted_fn_ok (void) = delete;
36 ~S() noexcept(false) = default;
43 _X tmpl_var_ok_0
= static_cast<_X
>(-1);
45 template <typename _T
>
46 constexpr _T tmpl_var_ok_1
= static_cast<_T
>(42);
48 inline int a
= tmpl_var_ok_1
<int>;
50 template <typename _Tp
,
51 template <typename
> class _T
>
52 constexpr int tmpl_var_ok_2
= _T
<_Tp
>::value
? 42 : 6174 ;
55 int tmpl_OK (_Ep
) { return 0; }
59 operator==(_T1
& , _T1
& ) { return false; }
61 constexpr long one_k
= 1000L;
63 template <class ..._Args
>
65 (_Args
...__args
) { return nullptr; }
67 inline int foo (int a
) {