diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/decltype25.C')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/decltype25.C | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype25.C b/gcc/testsuite/g++.dg/cpp0x/decltype25.C new file mode 100644 index 000000000..c9559f151 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype25.C @@ -0,0 +1,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(); +} |