On Nov 17, 2015, at 8:50 AM, David Edelsohn <dje....@gmail.com> wrote: > > Thanks for the pointer. How about the following?
Ok. sizeof (*wfoo) or sizeof (wchar_t) or some such might be even more portable. > > Thanks, David > > > Index: pr58708.C > =================================================================== > --- pr58708.C (revision 230463) > +++ pr58708.C (working copy) > @@ -43,7 +43,11 @@ > if (foo.chars[1] != 98) __builtin_abort(); > if (foo.chars[2] != 99) __builtin_abort(); > > - auto wfoo = L"\x01020304\x05060708"_foo; > +#if __SIZEOF_WCHAR_T__ == 2 > + auto wfoo = L"\x0102\x0304"_foo; > +#else > + auto wfoo = L"\x01020304\x05060708"_foo; > +#endif > if (is_same<decltype(wfoo)::char_type, wchar_t>::value != true) > __builtin_abort(); > if (sizeof(wfoo.chars)/sizeof(wchar_t) != 2) __builtin_abort(); > if (wfoo.chars[0] != 16909060) __builtin_abort();