brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · b19cccf Raw
108 lines · cpp
1// If this test fails, it should be investigated under Debug builds.2// Before the PR, this test was violating an assertion.3 4// RUN: rm -rf %t5// RUN: mkdir -p %t6// RUN: split-file %s %t7 8// RUN: %clang_cc1 -std=c++20 -emit-obj -fmodules \9// RUN:  -fmodule-map-file=%t/module.modulemap \10// RUN:  -fmodules-cache-path=%t %t/a.cpp11 12//--- module.modulemap13module ebo {14  header "ebo.h"15}16 17module fwd {18  header "fwd.h"19}20 21module s {22  header "s.h"23  export *24}25 26module mod {27  header "a.h"28  header "b.h"29}30 31//--- ebo.h32#pragma once33 34namespace N { inline namespace __1 {35 36template <typename T>37struct EBO : T {38  EBO() = default;39};40 41}}42 43//--- fwd.h44#pragma once45 46namespace N { inline namespace __1 {47 48template <typename T>49struct Empty;50 51template <typename T>52struct BS;53 54using S = BS<Empty<char>>;55 56}}57 58//--- s.h59#pragma once60 61#include "fwd.h"62#include "ebo.h"63 64namespace N { inline namespace __1 {65 66template <typename T>67struct Empty {};68 69template <typename T>70struct BS {71    EBO<T> _;72    void f();73};74 75extern template void BS<Empty<char>>::f();76 77}}78 79//--- b.h80#pragma once81 82#include "s.h"83 84struct B {85  void f() {86    N::S{}.f();87  }88};89 90//--- a.h91#pragma once92 93#include "s.h"94 95struct A {96  void f(int) {}97  void f(const N::S &) {}98 99  void g();100};101 102//--- a.cpp103#include "a.h"104 105void A::g() { f(0); }106 107// expected-no-diagnostics108