summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/decltype25.C
blob: c9559f1511a09f3611a560a836ab8ebae25bb0d2 (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-options -std=c++0x }

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();
}