The remaining modules tests use the std library. These are those.
gcc/testsuite/
* g++.dg/modules/binding-1_a.H: New.
* g++.dg/modules/binding-1_b.H: New.
* g++.dg/modules/binding-1_c.C: New.
* g++.dg/modules/binding-2.H: New.
* g++.dg/modules/builtin-3_a.C: New.
* g++.dg/modules/global-2_a.C: New.
* g++.dg/modules/global-2_b.C: New.
* g++.dg/modules/global-3_a.C: New.
* g++.dg/modules/global-3_b.C: New.
* g++.dg/modules/hello-1_a.C: New.
* g++.dg/modules/hello-1_b.C: New.
* g++.dg/modules/iostream-1_a.H: New.
* g++.dg/modules/iostream-1_b.C: New.
* g++.dg/modules/part-5_a.C: New.
* g++.dg/modules/part-5_b.C: New.
* g++.dg/modules/part-5_c.C: New.
* g++.dg/modules/stdio-1_a.H: New.
* g++.dg/modules/stdio-1_b.C: New.
* g++.dg/modules/string-1_a.H: New.
* g++.dg/modules/string-1_b.C: New.
* g++.dg/modules/string-view1.C: New.
* g++.dg/modules/string-view2.C: New.
* g++.dg/modules/tinfo-1.C: New.
* g++.dg/modules/tinfo-2_a.H: New.
* g++.dg/modules/tinfo-2_b.C: New.
* g++.dg/modules/tname-spec-1_a.H: New.
* g++.dg/modules/tname-spec-1_b.C: New.
* g++.dg/modules/xtreme-header-1.h: New.
* g++.dg/modules/xtreme-header-1_a.H: New.
* g++.dg/modules/xtreme-header-1_b.C: New.
* g++.dg/modules/xtreme-header-1_c.C: New.
* g++.dg/modules/xtreme-header-2.h: New.
* g++.dg/modules/xtreme-header-2_a.H: New.
* g++.dg/modules/xtreme-header-2_b.C: New.
* g++.dg/modules/xtreme-header-2_c.C: New.
* g++.dg/modules/xtreme-header-3.h: New.
* g++.dg/modules/xtreme-header-3_a.H: New.
* g++.dg/modules/xtreme-header-3_b.C: New.
* g++.dg/modules/xtreme-header-3_c.C: New.
* g++.dg/modules/xtreme-header-4.h: New.
* g++.dg/modules/xtreme-header-4_a.H: New.
* g++.dg/modules/xtreme-header-4_b.C: New.
* g++.dg/modules/xtreme-header-4_c.C: New.
* g++.dg/modules/xtreme-header-5.h: New.
* g++.dg/modules/xtreme-header-5_a.H: New.
* g++.dg/modules/xtreme-header-5_b.C: New.
* g++.dg/modules/xtreme-header-5_c.C: New.
* g++.dg/modules/xtreme-header-6.h: New.
* g++.dg/modules/xtreme-header-6_a.H: New.
* g++.dg/modules/xtreme-header-6_b.C: New.
* g++.dg/modules/xtreme-header-6_c.C: New.
* g++.dg/modules/xtreme-header.h: New.
* g++.dg/modules/xtreme-header_a.H: New.
* g++.dg/modules/xtreme-header_b.C: New.
* g++.dg/modules/xtreme-tr1.h: New.
* g++.dg/modules/xtreme-tr1_a.H: New.
* g++.dg/modules/xtreme-tr1_b.C: New.
--- /dev/null
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+#include <iostream>
--- /dev/null
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+
+#include <string>
--- /dev/null
+// { dg-additional-options -fmodules-ts }
+
+export module hello;
+// { dg-module-cmi hello }
+
+import "binding-1_a.H";
+import "binding-1_b.H";
--- /dev/null
+// { dg-additional-options "-fmodule-header -Wextra" }
+// { dg-module-cmi {} }
+
+void* operator new(__SIZE_TYPE__, void* __p) noexcept;
+void* operator new[](__SIZE_TYPE__, void* __p) noexcept;
+
+void operator delete (void*, void*) noexcept;
+void operator delete[](void*, void*) noexcept;
+
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fdump-lang-module-blocks-alias-uid" }
+module;
+#include <stdarg.h>
+export module builtins;
+// { dg-module-cmi builtins }
+
+export inline unsigned length (char const *ptr)
+{
+ return __builtin_strlen (ptr);
+}
+
+export inline int count (int a, ...)
+{
+ int c = 0;
+
+ va_list args;
+ va_start (args, a);
+ while (va_arg (args, char *))
+ c++;
+ va_end (args);
+
+ return c;
+}
+
+// { dg-final { scan-lang-dump-not {Cluster members:\n \[0\]=decl declaration '::__builtin_strlen'\n \[1\]=binding '::__builtin_strlen'\n} module } }
+// { dg-final { scan-lang-dump {Wrote GMF:-[0-9]* function_decl:'::__builtin_strlen'@builtins} module } }
+// { dg-final { scan-lang-dump {Writing:-[0-9]*'s named merge key \(decl\) function_decl:'::__builtin_strlen'} module } }
+// { dg-final { scan-lang-dump-not {Writing tree:-[0-9]* function_decl:'__builtin_strlen'\(strlen\)} module } }
+
+// The implementation details of va_list's are target-specific.
+// Usually one of two patterns though
+// { dg-final { scan-lang-dump-not { Cluster members:\n \[0\]=decl declaration '::__builtin_va_list'\n \[1\]=binding '::__builtin_va_list'\n} module { target i?86-*-linux* x86_64-*-linux* } } }
+// { dg-final { scan-lang-dump {Wrote GMF:-[0-9]* type_decl:'::__builtin_va_list'@builtins} module { target x86_64-*-linux* } } }
+// { dg-final { scan-lang-dump {Writing:-[0-9]*'s named merge key \(decl\) type_decl:'::__builtin_va_list'} module { target x86_64-*-linux* } } }
+
+// { dg-final { scan-lang-dump {Writing:-1's named merge key \(decl\) type_decl:'::__gnuc_va_list'} module { target i?86-*-linux* *-*-darwin* } } }
+// { dg-final { scan-lang-dump {Wrote GMF:-3 type_decl:'::__gnuc_va_list'@builtins} module { target i?86-*-linux* *-*-darwin* } } }
+
+// { dg-final { scan-lang-dump {Wrote fixed:[0-9]* record_type:'__va_list'} module { target aarch64*-*-linux* } } }
+// { dg-final { scan-lang-dump {Wrote fixed:[0-9]* pointer_type:'::__builtin_va_list'} module { target powerpc*-*-linux* } } }
+
+// { dg-final { scan-lang-dump-not { Cluster members:\n \[0\]=decl declaration '::va_list'\n \[1\]=binding '::va_list'\n} module } }
+// { dg-final { scan-lang-dump {Wrote GMF:-[0-9]* type_decl:'::va_list'@builtins} module } }
+// { dg-final { scan-lang-dump {Writing:-[0-9]*'s named merge key \(decl\) type_decl:'::va_list'} module } }
--- /dev/null
+// { dg-module-do run }
+// { dg-additional-options "-fmodules-ts -fdump-lang-module-graph" }
+module;
+#include <stdio.h>
+#include <stdarg.h>
+export module logger;
+// { dg-module-cmi logger }
+
+export void Log (char const *fmt, ...)
+{
+ va_list args;
+ va_start (args, fmt);
+ printf ("Logging:");
+ vprintf (fmt, args);
+ printf ("\n");
+ va_end (args);
+}
+
+// { dg-final { scan-lang-dump {Dependencies of decl function_decl:'::Log'} module } }
+// not reachable (body not inline)
+// { dg-final { scan-lang-dump-not {Reachable GMF '::printf[^\n']*' added} module } }
+
--- /dev/null
+// { dg-additional-options "-fmodules-ts" }
+
+import logger;
+
+int main ()
+{
+ Log ("hello world!");
+ return 0;
+}
+
--- /dev/null
+// { dg-module-do run }
+// { dg-additional-options "-fmodules-ts -fdump-lang-module-graph" }
+module;
+#include <iostream>
+export module logger;
+// { dg-module-cmi logger }
+
+export void Log (char const *msg)
+{
+ std::cout << "Logging:" << msg << "\n";
+}
+
+// { dg-final { scan-lang-dump {Dependencies of decl function_decl:'::Log'} module } }
+// not reachable (body not inline)
+// { dg-final { scan-lang-dump-not {Reachable GMF '::printf[^'\n]*' added} module } }
+
--- /dev/null
+// { dg-additional-options "-fmodules-ts" }
+
+import logger;
+
+int main ()
+{
+ Log ("hello world!");
+ return 0;
+}
--- /dev/null
+// { dg-module-do run }
+// { dg-additional-options -fmodules-ts }
+
+module;
+#include <iostream>
+#include <string_view>
+export module hello;
+// { dg-module-cmi hello }
+export void greeter (std::string_view const &name)
+{
+ std::cout << "Hello " << name << "!\n";
+}
--- /dev/null
+// { dg-additional-options -fmodules-ts }
+
+#include <string_view>
+import hello;
+int main (void)
+{
+ greeter ("world");
+ return 0;
+}
--- /dev/null
+// { dg-module-do run }
+// { dg-additional-options "-fmodule-header" }
+// { dg-module-cmi {} }
+
+#ifndef MY_IOSTREAM_H
+#define MY_IOSTREAM_H
+/* Proxy iostream, because command line in flux. */
+#include <iostream>
+
+#endif
--- /dev/null
+// { dg-additional-options -fmodules-ts }
+
+import "iostream-1_a.H";
+
+int main ()
+{
+ std::cout << "hello world!\n";
+ return 0;
+}
--- /dev/null
+// { dg-additional-options -fmodules-ts }
+
+// a bug report ICE with namespace introduced in partition.
+export module module1:submodule1;
+// { dg-module-cmi module1:submodule1 }
+
+export namespace nmspc{
+ class Cl1{
+ public:
+ Cl1(){}
+ int x=14;
+ };
+}
--- /dev/null
+// { dg-additional-options -fmodules-ts }
+
+export module module1;
+// { dg-module-cmi module1 }
+
+export import :submodule1;
--- /dev/null
+// { dg-additional-options -fmodules-ts }
+
+#include <iostream>
+import module1;
+
+int main(int argc, char const *argv[]) {
+ nmspc::Cl1 c1;
+ std::cout << c1.x;
+ return 0;
+}
--- /dev/null
+// { dg-module-do run }
+// { dg-additional-options "-fmodule-header -fdump-lang-module" }
+// { dg-module-cmi {} }
+
+#ifndef _PROXY_STDIO_H
+#define _PROXY_STDIO_H
+/* Proxy stdio.h, because command line in flux. */
+#include <stdio.h>
+
+#endif
+// There should be *lots* of depsets (209 for glibc today)
+// { dg-final { scan-lang-dump {Writing section:60 } module } }
+// { dg-final { scan-lang-dump {Depset:0 decl entity:[0-9]* function_decl:'::printf'} module } }
+// { dg-final { scan-lang-dump {Depset:1 binding namespace_decl:'::printf'} module } }
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fdump-lang-module" }
+
+import "stdio-1_a.H";
+
+int main ()
+{
+ printf ("hello world!\n");
+ return 0;
+}
+
+// { dg-final { scan-lang-dump {Bindings '::printf' section:} module } }
+// { dg-final { scan-lang-dump {Lazily binding '::printf'@'[^\n]*stdio-1_a.H' section:} module } }
+// Make sure we don't load spurious stuff
+// { dg-final { scan-lang-dump-not {binding '::scanf'@'[^\n]*'} module } }
--- /dev/null
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include <string>
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include <string>
+import "string-1_a.H";
+
--- /dev/null
+// { dg-additional-options "-fmodules-ts" }
+module;
+#include <cstdio>
+#include <string_view>
+export module foo;
+// { dg-module-cmi foo }
--- /dev/null
+// { dg-additional-options "-fmodules-ts" }
+// reduced from string-view1 through cvise. Broken under c++2a too.
+// we were creating a hash slot, and then doing another lookup without
+// initializing that first slot :(
+
+namespace std {
+typedef int a;
+int b;
+decltype(nullptr) c;
+namespace xyz {}
+__builtin_va_list d;
+int n;
+int e;
+int f;
+int g;
+int h;
+int i;
+int j;
+int k;
+typedef struct l m;
+typedef struct aa w;
+typedef struct x o;
+typedef x p;
+long q;
+long r;
+typedef l s;
+extern p ab;
+void t();
+void v();
+extern p ac;
+void ad();
+int ae;
+int af;
+extern p ag;
+extern p ah;
+void ai();
+void y();
+int aj;
+int ak;
+int al;
+char am;
+int an;
+a ao;
+int ap;
+int aq;
+void z();
+int ar;
+int as;
+void at();
+void au();
+void av();
+void aw();
+int u;
+namespace zz {
+}
+}
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fdump-lang-module-uid" }
+export module Foo;
+// { dg-module-cmi Foo }
+
+struct B
+{
+};
+
+struct C : B
+{
+};
+
+inline void foo ()
+{
+ throw C ();
+}
+
+// { dg-final { scan-lang-dump {Writing typedef type_decl:'::__si_class_type_info_pseudo_9'} module } }
+// { dg-final { scan-lang-dump {Wrote tinfo_type:-[0-9]* 9 '::__si_class_type_info_pseudo_9'} module } }
+// { dg-final { scan-lang-dump-not {Writing tree:-[0-9]* type_decl:'__si_class_type_info_pseudo_9'} module } }
--- /dev/null
+// { dg-additional-options "-fmodule-header" }
+// { dg-module-cmi {} }
+
+#include <typeinfo>
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+import "tinfo-2_a.H";
+
--- /dev/null
+// { dg-module-do run }
+// { dg-additional-options -fmodule-header }
+
+template<template<typename> class _Op>
+using __detected_or_t = long;
+
+template<typename _Ptr>
+struct pointer_traits
+{
+ template<typename _Tp>
+ using __difference_type = typename _Tp::difference_type;
+
+ using difference_type = __detected_or_t<__difference_type>;
+};
+
--- /dev/null
+// { dg-additional-options -fmodules-ts }
+
+#include <typeinfo>
+import "tname-spec-1_a.H";
+
+struct X
+{
+ using difference_type = char;
+};
+
+pointer_traits<X>::difference_type x;
+
+int main ()
+{
+ return !(typeid (x) == typeid (long));
+}
--- /dev/null
+// All the headers tickle a location bug. so subsets of the STL :(
+
+// C compatibility
+#include <cassert>
+#include <cerrno>
+#include <cfenv>
+#include <cfloat>
+#include <cinttypes>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
--- /dev/null
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-header-1.h"
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-header-1.h"
+import "xtreme-header-1_a.H";
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+import "xtreme-header-1_a.H";
--- /dev/null
+// Everything that transitively includes <ranges>
+
+#include <algorithm>
+// FIXME: PR 97549
+// #include <execution>
+#include <functional>
+#include <future>
+#include <memory>
+#include <memory_resource>
+#include <regex>
+#include <scoped_allocator>
+#include <thread>
+#include <valarray>
+#include <ranges>
--- /dev/null
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-header-2.h"
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-header-2.h"
+import "xtreme-header-2_a.H";
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+import "xtreme-header-2_a.H";
--- /dev/null
+// Containers (except ranges-including ones)
+
+#include <array>
+#include <bitset>
+#include <deque>
+#include <forward_list>
+#include <initializer_list>
+#include <iterator>
+#include <list>
+#include <map>
+#include <optional>
+#include <queue>
+#include <set>
+#include <stack>
+#include <string>
+#include <string_view>
+#include <tuple>
+#include <unordered_map>
+#include <unordered_set>
+#include <variant>
+#include <vector>
--- /dev/null
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-header-3.h"
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-header-3.h"
+import "xtreme-header-3_a.H";
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+import "xtreme-header-3_a.H";
--- /dev/null
+// io
+
+#include <charconv>
+#include <cctype>
+#include <cuchar>
+#include <cwchar>
+#include <cwctype>
+#include <filesystem>
+#include <fstream>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <istream>
+#include <locale>
+#include <ostream>
+#include <sstream>
+#include <streambuf>
--- /dev/null
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-header-4.h"
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-header-4.h"
+import "xtreme-header-4_a.H";
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+import "xtreme-header-4_a.H";
--- /dev/null
+// Remaining C++17 headers
+
+// C++ 17 and below
+#include <any>
+#include <atomic>
+#include <chrono>
+#include <complex>
+#include <condition_variable>
+#include <exception>
+#include <limits>
+#include <mutex>
+#include <new>
+#include <numeric>
+#include <random>
+#include <ratio>
+#include <shared_mutex>
+#include <stdexcept>
+#include <system_error>
+#include <type_traits>
+#include <typeindex>
+#include <typeinfo>
+#include <utility>
--- /dev/null
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-header-5.h"
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-header-5.h"
+import "xtreme-header-5_a.H";
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+import "xtreme-header-5_a.H";
--- /dev/null
+// C++20 headers
+#if __cplusplus > 201703
+#include <version>
+#include <bit>
+#include <compare>
+#include <concepts>
+#if __cpp_coroutines
+#include <coroutine>
+#endif
+#include <numbers>
+#include <span>
+#include <stop_token>
+#if 0
+// Unimplemented
+#include <barrier>
+#include <format>
+#include <latch>
+#include <semaphore>
+#include <source_location>
+#include <syncstream>
+#endif
+#endif
--- /dev/null
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-header-6.h"
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-header-6.h"
+import "xtreme-header-6_a.H";
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+import "xtreme-header-6_a.H";
--- /dev/null
+// All the headers!
+
+#if __cplusplus > 201703L
+// FIXME: if we include everything, something goes wrong with location
+// information. We used to not handle lambdas attached to global
+// vars, and this is a convienient flag to stop including everything.
+#define NO_ASSOCIATED_LAMBDA 1
+#endif
+
+// C++ 17 and below
+#if 1
+#if !NO_ASSOCIATED_LAMBDA
+#include <algorithm>
+#endif
+#include <any>
+#include <array>
+#include <atomic>
+#include <bitset>
+#include <charconv>
+#include <chrono>
+#include <complex>
+#include <condition_variable>
+#include <cctype>
+#include <cuchar>
+#include <cwchar>
+#include <cwctype>
+#include <deque>
+#include <exception>
+#if !NO_ASSOCIATED_LAMBDA
+// FIXME: PR 97549
+//#include <execution>
+#endif
+#include <filesystem>
+#include <forward_list>
+#include <fstream>
+#if !NO_ASSOCIATED_LAMBDA
+#include <functional>
+#endif
+#if !NO_ASSOCIATED_LAMBDA
+#include <future>
+#endif
+#include <initializer_list>
+#include <iomanip>
+#include <ios>
+#include <iosfwd>
+#include <istream>
+#include <iterator>
+#include <limits>
+#include <list>
+#include <locale>
+#include <map>
+#if !NO_ASSOCIATED_LAMBDA
+#include <memory>
+#endif
+#if !NO_ASSOCIATED_LAMBDA
+#include <memory_resource>
+#endif
+#include <mutex>
+#include <new>
+#include <numeric>
+#include <optional>
+#include <ostream>
+#include <queue>
+#include <random>
+#include <ratio>
+#if !NO_ASSOCIATED_LAMBDA
+#include <regex>
+#endif
+#if !NO_ASSOCIATED_LAMBDA
+#include <scoped_allocator>
+#endif
+#include <set>
+#include <shared_mutex>
+#include <sstream>
+#include <stack>
+#include <stdexcept>
+#include <streambuf>
+#include <string>
+#include <string_view>
+#include <system_error>
+#if !NO_ASSOCIATED_LAMBDA
+#include <thread>
+#endif
+#include <tuple>
+#include <type_traits>
+#include <typeindex>
+#include <typeinfo>
+#include <unordered_map>
+#include <unordered_set>
+#include <utility>
+#if !NO_ASSOCIATED_LAMBDA
+#include <valarray>
+#endif
+#include <variant>
+#include <vector>
+#endif
+
+// C compatibility
+#if 1
+#include <cassert>
+#include <cerrno>
+#include <cfenv>
+#include <cfloat>
+#include <cinttypes>
+#include <climits>
+#include <clocale>
+#include <cmath>
+#include <csetjmp>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#endif
+
+// C++20
+#if __cplusplus > 201703
+#if 1
+#include <version>
+#include <bit>
+#include <compare>
+#include <concepts>
+#if __cpp_coroutines
+#include <coroutine>
+#endif
+#if !NO_ASSOCIATED_LAMBDA
+#include <ranges>
+#endif
+#include <numbers>
+#include <span>
+#include <stop_token>
+#if 0
+// Unimplemented
+#include <barrier>
+#include <format>
+#include <latch>
+#include <semaphore>
+#include <source_location>
+#include <syncstream>
+#endif
+#endif
+#endif
--- /dev/null
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-header.h"
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-header.h"
+import "xtreme-header_a.H";
--- /dev/null
+#include <tr1/functional>
+#include <tr1/array>
+#include <tr1/complex>
+#include <tr1/memory>
+#include <tr1/random>
+#include <tr1/regex>
+#include <tr1/tuple>
+#include <tr1/type_traits>
+#include <tr1/unordered_map>
+#include <tr1/unordered_set>
+#include <tr1/utility>
--- /dev/null
+// { dg-additional-options -fmodule-header }
+
+// { dg-module-cmi {} }
+#include "xtreme-tr1.h"
--- /dev/null
+// { dg-additional-options "-fmodules-ts -fno-module-lazy" }
+
+#include "xtreme-tr1.h"
+import "xtreme-tr1_a.H";