Richard Smith | 762bb9d | 2011-10-13 22:29:44 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s |
Andy Gibbs | 8e8fb3b | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
Daniel Dunbar | ba69b3c | 2009-11-14 03:24:04 +0000 | [diff] [blame] | 3 | |
Anders Carlsson | 4e57992 | 2009-07-10 21:35:09 +0000 | [diff] [blame] | 4 | template<typename T, typename U> struct is_same { |
| 5 | static const bool value = false; |
| 6 | }; |
| 7 | |
| 8 | template<typename T> struct is_same<T, T> { |
| 9 | static const bool value = true; |
| 10 | }; |
| 11 | |
| 12 | struct S { |
| 13 | void f() { static_assert(is_same<decltype(this), S*>::value, ""); } |
| 14 | void g() const { static_assert(is_same<decltype(this), const S*>::value, ""); } |
| 15 | void h() volatile { static_assert(is_same<decltype(this), volatile S*>::value, ""); } |
| 16 | void i() const volatile { static_assert(is_same<decltype(this), const volatile S*>::value, ""); } |
| 17 | }; |