brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 3c12065 Raw
35 lines · cpp
1// This tests for [basic.lookup.argdep]/p4.2:2//   Argument-dependent lookup finds all declarations of functions and function templates that3// - ...4// - are declared as a friend ([class.friend]) of any class with a reachable definition in the set of associated entities,5//6// RUN: rm -fr %t7// RUN: mkdir %t8// RUN: split-file %s %t9//10// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/Friend-in-reachable-class.cppm -o %t/X.pcm11// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/Friend-in-reachable-class.cppm \12// RUN:   -o %t/X.reduced.pcm13// RUN: %clang_cc1 -std=c++20 -fmodule-file=X=%t/X.pcm %t/Use.cpp -verify -fsyntax-only14// RUN: %clang_cc1 -std=c++20 -fmodule-file=X=%t/X.reduced.pcm %t/Use.cpp -verify -fsyntax-only15//16//--- Friend-in-reachable-class.cppm17module;18# 3 __FILE__ 119struct A {20  friend int operator+(const A &lhs, const A &rhs) {21    return 0;22  }23};24# 6 "" 225export module X;26export using ::A;27 28//--- Use.cpp29// expected-no-diagnostics30import X;31int use() {32  A a, b;33  return a + b;34}35