aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-friend.C
blob: 55a2329eb54ce01be733b970665f4d81e50b8186 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// PR c++/48948
// { dg-do compile { target c++11 } }

struct A { A(); };

struct B {
  friend constexpr int f(B) { return 0; } // OK
  friend constexpr int f(A) { return 0; } // { dg-error "constexpr" }
};

template <class T>
struct C
{
  friend constexpr int f(C) { return 0; }
  friend constexpr int g(C, A) { return 0; } // { dg-error "double" }
  constexpr int m(C) { return 0; }
  constexpr int m(A) { return 0; } // { dg-error "double" }
};

constexpr int i = f(C<int>());
constexpr int j = C<int>().m(C<int>());
constexpr int k = C<double>().m(A()); // { dg-error "constexpr" }
constexpr int l = g(C<double>(),A()); // { dg-error "constexpr" }