aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/Shell/Settings/Inputs/names.cpp
blob: 79ff93be6b76ed376f9ee88aab24fad04719db88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
namespace detail {
template <typename T> struct Quux {};
} // namespace detail

using FuncPtr = detail::Quux<double> (*(*)(int))(float);

struct Foo {
  template <typename T> void foo(T arg) const noexcept(true) {}

  template <int T> void operator<<(int) {}

  template <typename T> FuncPtr returns_func_ptr(detail::Quux<int> &&) const noexcept(false) { return nullptr; }
};

namespace ns {
template <typename T> int foo(char const *str) noexcept(false) { return 0; }
template <typename T> int foo(T t) { return 1; }

template <typename T> FuncPtr returns_func_ptr(detail::Quux<int> &&) { return nullptr; }
} // namespace ns

int bar() { return 1; }

namespace {
int anon_bar() { return 1; }
auto anon_lambda = [] {};
} // namespace

__attribute__((always_inline)) int inlined_foo(const char *str) {
  if (bool b = bar())
    return 1;
  return 2;
}

int main() {
  ns::foo<decltype(bar)>(bar);
  ns::foo<decltype(bar)>("bar");
  ns::foo(anon_lambda);
  ns::foo(anon_bar);
  ns::foo<decltype(&Foo::foo<int(int)>)>("method");
  ns::returns_func_ptr<int>(detail::Quux<int>{});
  Foo f;
  f.foo(anon_bar);
  f.operator<< <(2 > 1)>(0);
  f.returns_func_ptr<int>(detail::Quux<int>{});
  inlined_foo("bar");
  return 0;
}