Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / module / module.import / p6.cpp
blob0ed8b5958dffe740399fc4d8e75aebe5ef7ad922
1 // RUN: mkdir -p %t
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;}
11 static int ok_bar ();
13 int ok_decl ();
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;
21 int ok_var_decl;
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. */
27 class A {
28 public:
29 // This is a declaration instead of definition.
30 static const int value = 43;
33 void deleted_fn_ok (void) = delete;
35 struct S {
36 ~S() noexcept(false) = default;
37 private:
38 S(S&);
40 S::S(S&) = default;
42 template <class _X>
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 ;
54 template<class _Ep>
55 int tmpl_OK (_Ep) { return 0; }
57 template <class _T1>
58 bool
59 operator==(_T1& , _T1& ) { return false; }
61 constexpr long one_k = 1000L;
63 template <class ..._Args>
64 void* tmpl_fn_ok
65 (_Args ...__args) { return nullptr; }
67 inline int foo (int a) {
68 return tmpl_OK (a);