brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · a3644b4 Raw
80 lines · plain
1// RUN: rm -rf %t2// RUN: split-file %s %t3// RUN: cd %t4//5// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm6// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=a=%t/a.pcm  -emit-module-interface \7// RUN:     -o %t/b.pcm8// RUN: %clang_cc1 -std=c++20 %t/c.cppm -fmodule-file=a=%t/a.pcm -fmodule-file=b=%t/b.pcm \9// RUN:     -fsyntax-only -verify10//11// RUN: %clang_cc1 -std=c++20 -DEXPORT_OPERATOR %t/a.cppm -emit-module-interface -o %t/a.pcm12// RUN: %clang_cc1 -std=c++20 -DEXPORT_OPERATOR %t/b.cppm -fmodule-file=a=%t/a.pcm  \13// RUN:     -emit-module-interface -o %t/b.pcm14// RUN: %clang_cc1 -std=c++20 -DEXPORT_OPERATOR %t/c.cppm -fmodule-file=a=%t/a.pcm \15// RUN:     -fmodule-file=b=%t/b.pcm -fsyntax-only -verify16 17// Test again with reduced BMI.18//19// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm20// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=a=%t/a.pcm  -emit-reduced-module-interface \21// RUN:     -o %t/b.pcm22// RUN: %clang_cc1 -std=c++20 %t/c.cppm -fmodule-file=a=%t/a.pcm -fmodule-file=b=%t/b.pcm \23// RUN:     -fsyntax-only -verify24//25// RUN: %clang_cc1 -std=c++20 -DEXPORT_OPERATOR %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm26// RUN: %clang_cc1 -std=c++20 -DEXPORT_OPERATOR %t/b.cppm -fmodule-file=a=%t/a.pcm  \27// RUN:     -emit-reduced-module-interface -o %t/b.pcm28// RUN: %clang_cc1 -std=c++20 -DEXPORT_OPERATOR %t/c.cppm -fmodule-file=a=%t/a.pcm \29// RUN:     -fmodule-file=b=%t/b.pcm -fsyntax-only -verify30 31//--- foo.h32namespace n {33 34struct s { };35 36void operator+(s, int) {}37 38} // namespace n39 40//--- a.cppm41module;42#include "foo.h"43export module a;44export namespace n {45    using n::s;46#ifdef EXPORT_OPERATOR47    using n::operator+;48#endif49}50 51//--- b.cppm52export module b;53export import a;54 55export template<typename T>56void b(T x) {57	n::s() + x;58}59 60//--- c.cppm61module;62#ifdef EXPORT_OPERATOR63// expected-no-diagnostics64#endif65export module c;66import b;67 68void c(int x) {69#ifndef EXPORT_OPERATOR70	// expected-error@b.cppm:6 {{invalid operands to binary expression ('n::s' and 'int')}}71    // expected-note@+2 {{in instantiation of function template specialization 'b<int>' requested here}}72#endif73    b(0);74 75#ifndef EXPORT_OPERATOR76    // expected-error@+2 {{invalid operands to binary expression ('n::s' and 'int')}}77#endif78    n::s() + x;79}80