1 // RUN: %clang_cc1 -std=c++11 %s -verify 2 // expected-no-diagnostics 3 4 using size_t = decltype(sizeof(0)); 5 template<typename T> struct check; 6 template<size_t N> struct check<const char[N]> {}; 7 startswith(const char * p,const char * q)8constexpr bool startswith(const char *p, const char *q) { 9 return !*q || (*p == *q && startswith(p + 1, q + 1)); 10 } contains(const char * p,const char * q)11constexpr bool contains(const char *p, const char *q) { 12 return *p && (startswith(p, q) || contains(p + 1, q)); 13 } 14 foo()15void foo() { 16 check<decltype(__func__)>(); 17 static_assert(contains(__func__, "foo"), ""); 18 } 19