[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
[llvm-project.git] / clang / test / SemaCXX / constexpr-duffs-device.cpp
blobf77d989b9d36f5228d9f632faeb85eb586c60982
1 // RUN: %clang_cc1 -std=c++1y -verify %s
3 // expected-no-diagnostics
4 constexpr void copy(const char *from, unsigned long count, char *to) {
5 unsigned long n = (count + 7) / 8;
6 switch(count % 8) {
7 case 0: do { *to++ = *from++;
8 case 7: *to++ = *from++;
9 case 6: *to++ = *from++;
10 case 5: *to++ = *from++;
11 case 4: *to++ = *from++;
12 case 3: *to++ = *from++;
13 case 2: *to++ = *from++;
14 case 1: *to++ = *from++;
15 } while(--n > 0);
19 struct S {
20 char stuff[14];
21 constexpr S() : stuff{} {
22 copy("Hello, world!", 14, stuff);
26 constexpr bool streq(const char *a, const char *b) {
27 while (*a && *a == *b) ++a, ++b;
28 return *a == *b;
31 static_assert(streq(S().stuff, "Hello, world!"), "should be same");
32 static_assert(!streq(S().stuff, "Something else"), "should be different");