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

struct Type {
  void display_type();
  void display_type() const { }
};

typedef Type const ConstType;

struct ConvertibleToType {
    operator Type&() { return *reinterpret_cast<Type*>(this); }
};

int main ()
{
  // Both lines should call the const variant.
  (true ? ConvertibleToType() : ConstType()).display_type();
  decltype((true ? ConvertibleToType() : ConstType()))().display_type();
}