| 1 |
// RUN: rm -fR %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
// RUN: cd %t |
| 4 |
// RUN: %clang_cc1 -verify -w -std=c++20 -fmodule-name=h1.h -emit-header-unit -xc++-user-header h1.h -o h1.pcm |
| 5 |
// RUN: %clang_cc1 -verify -w -std=c++20 -fmodule-map-file=module.modulemap -fmodule-file=h1.h=h1.pcm main.cpp -o main.o |
| 6 |
|
| 7 |
//--- module.modulemap |
| 8 |
module "h1.h" { |
| 9 |
header "h1.h" |
| 10 |
export * |
| 11 |
} |
| 12 |
|
| 13 |
//--- h0.h |
| 14 |
// expected-no-diagnostics |
| 15 |
#pragma once |
| 16 |
namespace std { |
| 17 |
|
| 18 |
template <class _CharT, class = _CharT, class = _CharT> class basic_string; |
| 19 |
|
| 20 |
namespace pmr { |
| 21 |
using string = basic_string<char>; |
| 22 |
} |
| 23 |
|
| 24 |
template <class, class, class> |
| 25 |
class __attribute__((__preferred_name__(pmr::string))) basic_string; |
| 26 |
|
| 27 |
template <class> class basic_string_view {}; |
| 28 |
|
| 29 |
template <class _CharT, class _Traits, class _Allocator> class basic_string { |
| 30 |
typedef _CharT value_type; |
| 31 |
typedef _Allocator allocator_type; |
| 32 |
struct __rep; |
| 33 |
public: |
| 34 |
template <class _Tp> |
| 35 |
basic_string(_Tp) {} |
| 36 |
basic_string operator+=(value_type); |
| 37 |
}; |
| 38 |
|
| 39 |
namespace filesystem { |
| 40 |
class path { |
| 41 |
typedef char value_type; |
| 42 |
value_type preferred_separator; |
| 43 |
typedef basic_string<value_type> string_type; |
| 44 |
typedef basic_string_view<value_type> __string_view; |
| 45 |
template <class _Source> void append(_Source) { |
| 46 |
__pn_ += preferred_separator; |
| 47 |
} |
| 48 |
void __root_directory() { append(string_type(__string_view{})); } |
| 49 |
string_type __pn_; |
| 50 |
}; |
| 51 |
} // namespace filesystem |
| 52 |
} // namespace std |
| 53 |
|
| 54 |
//--- h1.h |
| 55 |
// expected-no-diagnostics |
| 56 |
#pragma once |
| 57 |
|
| 58 |
#include "h0.h" |
| 59 |
|
| 60 |
//--- main.cpp |
| 61 |
// expected-no-diagnostics |
| 62 |
#include "h0.h" |
| 63 |
|
| 64 |
import "h1.h"; |