decltype-this.cpp revision 4e579922ada4e19618710878c32543322f86c9c8
1// RUN: clang-cc -fsyntax-only -verify -std=c++0x %t
2template<typename T, typename U> struct is_same {
3  static const bool value = false;
4};
5
6template<typename T> struct is_same<T, T> {
7  static const bool value = true;
8};
9
10struct S {
11  void f() { static_assert(is_same<decltype(this), S*>::value, ""); }
12  void g() const { static_assert(is_same<decltype(this), const S*>::value, ""); }
13  void h() volatile { static_assert(is_same<decltype(this), volatile S*>::value, ""); }
14  void i() const volatile { static_assert(is_same<decltype(this), const volatile S*>::value, ""); }
15};
16