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_char_memchr(kFoo,'x',4)==nullptr);// expected-error {{not an integral constant}} expected-note {{dereferenced one-past-the-end}}
static_assert(__builtin_char_memchr(nullptr,'x',3)==nullptr);// expected-error {{not an integral constant}} expected-note {{dereferenced null}}
static_assert(__builtin_char_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}}
static_assert(__builtin_memcpy(&global,null,sizeof(wchar_t)));// expected-error {{}} expected-note {{source of 'memcpy' is nullptr}}
static_assert(__builtin_memmove(&global,null,sizeof(wchar_t)));// expected-error {{}} expected-note {{source of 'memmove' is nullptr}}
static_assert(__builtin_wmemcpy(&global,null,sizeof(wchar_t)));// expected-error {{}} expected-note {{source of 'wmemcpy' is nullptr}}
static_assert(__builtin_wmemmove(&global,null,sizeof(wchar_t)));// expected-error {{}} expected-note {{source of 'wmemmove' is nullptr}}
static_assert(__builtin_memcpy(null,&global,sizeof(wchar_t)));// expected-error {{}} expected-note {{destination of 'memcpy' is nullptr}}
static_assert(__builtin_memmove(null,&global,sizeof(wchar_t)));// expected-error {{}} expected-note {{destination of 'memmove' is nullptr}}
static_assert(__builtin_wmemcpy(null,&global,sizeof(wchar_t)));// expected-error {{}} expected-note {{destination of 'wmemcpy' is nullptr}}
static_assert(__builtin_wmemmove(null,&global,sizeof(wchar_t)));// expected-error {{}} expected-note {{destination of 'wmemmove' is nullptr}}
static_assert(__builtin_memcpy(&global,fold((wchar_t*)123),sizeof(wchar_t)));// expected-error {{}} expected-note {{source of 'memcpy' is (void *)123}}
static_assert(__builtin_memcpy(fold(reinterpret_cast<wchar_t*>(123)),&global,sizeof(wchar_t)));// expected-error {{}} expected-note {{destination of 'memcpy' is (void *)123}}
constexprstructIncomplete*null_incomplete=0;
static_assert(__builtin_memcpy(null_incomplete,null_incomplete,sizeof(wchar_t)));// expected-error {{}} expected-note {{source of 'memcpy' is nullptr}}