65 lines · cpp
1// RUN: rm -fR %t2// RUN: split-file %s %t3// RUN: cd %t4// RUN: %clang_cc1 -verify -w -std=c++20 -fmodule-name=h1.h -emit-header-unit -xc++-user-header h1.h -o h1.pcm5// RUN: %clang_cc1 -verify -w -std=c++20 -fmodule-map-file=module.modulemap -fmodule-file=h1.h=h1.pcm main.cpp -o main.o6 7//--- module.modulemap8module "h1.h" {9 header "h1.h"10 export *11}12 13//--- h0.h14// expected-no-diagnostics15#pragma once16namespace std {17 18template <class _CharT, class = _CharT, class = _CharT> class basic_string;19 20namespace pmr {21using string = basic_string<char>;22}23 24template <class, class, class>25class __attribute__((__preferred_name__(pmr::string))) basic_string;26 27template <class> class basic_string_view {};28 29template <class _CharT, class _Traits, class _Allocator> class basic_string {30 typedef _CharT value_type;31 typedef _Allocator allocator_type;32 struct __rep;33public:34 template <class _Tp>35 basic_string(_Tp) {}36 basic_string operator+=(value_type);37};38 39namespace filesystem {40class 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 filesystem52} // namespace std53 54//--- h1.h55// expected-no-diagnostics56#pragma once57 58#include "h0.h"59 60//--- main.cpp61// expected-no-diagnostics62#include "h0.h"63 64import "h1.h";65