[clang][lex] NFCI: Use DirectoryEntryRef in ModuleMap::inferFrameworkModule()
[llvm-project.git] / clang / test / SemaTemplate / argument-dependent-lookup.cpp
blob77df49277fff5e06939fd241672ce9f5d3c0bfdf
1 // RUN: %clang_cc1 -std=c++14 -verify %s
2 // RUN: %clang_cc1 -std=c++14 -verify %s -DHAVE_UNQUALIFIED_LOOKUP_RESULTS
3 // expected-no-diagnostics
5 namespace address_of {
6 #ifdef HAVE_UNQUALIFIED_LOOKUP_RESULTS
7 struct Q {};
8 void operator&(Q);
9 #endif
11 template<typename T> struct A {
12 static constexpr auto x = &T::value;
15 template<typename T> struct B {
16 constexpr int operator&() { return 123; }
19 template<typename T> struct C {
20 static_assert(sizeof(T) == 123, "");
23 struct X1 {
24 static B<X1> value;
26 struct X2 : B<X2> {
27 enum E { value };
28 friend constexpr int operator&(E) { return 123; }
31 struct Y1 {
32 C<int> *value;
34 struct Y2 {
35 C<int> value();
38 // ok, uses ADL to find operator&:
39 static_assert(A<X1>::x == 123, "");
40 static_assert(A<X2>::x == 123, "");
42 // ok, does not use ADL so does not instantiate C<T>:
43 static_assert(A<Y1>::x == &Y1::value, "");
44 static_assert(A<Y2>::x == &Y2::value, "");