constexprintm=strlen("hello");// expected-error {{constant expression}} expected-note {{non-constexpr function 'strlen' cannot be used in a constant expression}}
constexprintwm=wcslen(L"hello");// expected-error {{constant expression}} expected-note {{non-constexpr function 'wcslen' cannot be used in a constant expression}}
static_assert(__builtin_strcmp(0,"abab")==0);// expected-error {{not an integral constant}} expected-note {{dereferenced null}}
static_assert(__builtin_strcmp("abab",0)==0);// expected-error {{not an integral constant}} expected-note {{dereferenced null}}
static_assert(__builtin_strcmp(kFoobar,kFoobazfoobar)==-1);// FIXME: Should we reject this?
static_assert(__builtin_strcmp(kFoobar,kFoobazfoobar+6)==0);// expected-error {{not an integral constant}} expected-note {{dereferenced one-past-the-end}}
static_assert(__builtin_strncmp(kFoobar,kFoobazfoobar+6,7)==0);// expected-error {{not an integral constant}} expected-note {{dereferenced one-past-the-end}}
static_assert(__builtin_memcmp("abab\0banana","abab\0banana",100)==0);// expected-error {{not an integral constant}} expected-note {{dereferenced one-past-the-end}}
static_assert(__builtin_memcmp("abab\0banana","abab\0canada",100)==-1);// FIXME: Should we reject this?
constexprinta=strcmp("hello","world");// expected-error {{constant expression}} expected-note {{non-constexpr function 'strcmp' cannot be used in a constant expression}}
constexprintb=strncmp("hello","world",3);// expected-error {{constant expression}} expected-note {{non-constexpr function 'strncmp' cannot be used in a constant expression}}
constexprintc=memcmp("hello","world",3);// expected-error {{constant expression}} expected-note {{non-constexpr function 'memcmp' cannot be used in a constant expression}}
static_assert(__builtin_wcscmp(0,L"abab")==0);// expected-error {{not an integral constant}} expected-note {{dereferenced null}}
static_assert(__builtin_wcscmp(L"abab",0)==0);// expected-error {{not an integral constant}} expected-note {{dereferenced null}}
static_assert(__builtin_wcscmp(kFoobar,kFoobazfoobar)==-1);// FIXME: Should we reject this?
static_assert(__builtin_wcscmp(kFoobar,kFoobazfoobar+6)==0);// expected-error {{not an integral constant}} expected-note {{dereferenced one-past-the-end}}
static_assert(__builtin_wcsncmp(kFoobar,kFoobazfoobar+6,7)==0);// expected-error {{not an integral constant}} expected-note {{dereferenced one-past-the-end}}
static_assert(__builtin_wmemcmp(L"abab\0banana",L"abab\0banana",100)==0);// expected-error {{not an integral constant}} expected-note {{dereferenced one-past-the-end}}
static_assert(__builtin_wmemcmp(L"abab\0banana",L"abab\0canada",100)==-1);// FIXME: Should we reject this?
constexprinta=wcscmp(L"hello",L"world");// expected-error {{constant expression}} expected-note {{non-constexpr function 'wcscmp' cannot be used in a constant expression}}
constexprintb=wcsncmp(L"hello",L"world",3);// expected-error {{constant expression}} expected-note {{non-constexpr function 'wcsncmp' cannot be used in a constant expression}}
constexprintc=wmemcmp(L"hello",L"world",3);// expected-error {{constant expression}} expected-note {{non-constexpr function 'wmemcmp' cannot be used in a constant expression}}
static_assert(__builtin_memchr(kFoo,'x',4)==nullptr);// expected-error {{not an integral constant}} expected-note {{dereferenced one-past-the-end}}
static_assert(__builtin_memchr(nullptr,'x',3)==nullptr);// expected-error {{not an integral constant}} expected-note {{dereferenced null}}
static_assert(__builtin_memchr(nullptr,'x',0)==nullptr);// FIXME: Should we reject this?
constexprboola=!strchr("hello",'h');// expected-error {{constant expression}} expected-note {{non-constexpr function 'strchr' cannot be used in a constant expression}}
constexprboolb=!memchr("hello",'h',3);// expected-error {{constant expression}} expected-note {{non-constexpr function 'memchr' cannot be used in a constant expression}}
static_assert(__builtin_wmemchr(kFoo,L'x',4)==nullptr);// expected-error {{not an integral constant}} expected-note {{dereferenced one-past-the-end}}
static_assert(__builtin_wmemchr(nullptr,L'x',3)==nullptr);// expected-error {{not an integral constant}} expected-note {{dereferenced null}}
static_assert(__builtin_wmemchr(nullptr,L'x',0)==nullptr);// FIXME: Should we reject this?
constexprboola=!wcschr(L"hello",L'h');// expected-error {{constant expression}} expected-note {{non-constexpr function 'wcschr' cannot be used in a constant expression}}
constexprboolb=!wmemchr(L"hello",L'h',3);// expected-error {{constant expression}} expected-note {{non-constexpr function 'wmemchr' cannot be used in a constant expression}}