|
1 |
| -// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors |
| 1 | +// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98 -fexceptions -fcxx-exceptions -pedantic-errors |
2 | 2 | // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-20,since-cxx11,cxx11-14 -fexceptions -fcxx-exceptions -pedantic-errors
|
3 | 3 | // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-20,since-cxx11,cxx11-14,cxx14-17 -fexceptions -fcxx-exceptions -pedantic-errors
|
4 | 4 | // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-20,since-cxx11,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors
|
5 | 5 | // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-20,since-cxx20,since-cxx11,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors
|
6 | 6 | // RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx23,since-cxx20,since-cxx11,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors
|
7 | 7 | // RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx23,since-cxx20,since-cxx11,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors
|
8 | 8 |
|
| 9 | +#if __cplusplus == 199711L |
| 10 | +#define static_assert(...) __extension__ _Static_assert(__VA_ARGS__) |
| 11 | +// cxx98-error@-1 {{variadic macros are a C99 feature}} |
| 12 | +#endif |
| 13 | + |
9 | 14 | namespace cwg1512 { // cwg1512: 4
|
10 | 15 | void f(char *p) {
|
11 | 16 | if (p > 0) {}
|
@@ -556,24 +561,33 @@ auto CWG1579_lambda_invalid = []() -> GenericMoveOnly<char> {
|
556 | 561 | } // end namespace cwg1579
|
557 | 562 |
|
558 | 563 | namespace cwg1584 { // cwg1584: 7 drafting 2015-05
|
559 |
| -#if __cplusplus >= 201103L |
560 |
| - // Deducing function types from cv-qualified types |
561 |
| - template<typename T> void f(const T *); // #cwg1584-f |
562 |
| - template<typename T> void g(T *, const T * = 0); |
563 |
| - template<typename T> void h(T *) { T::error; } |
564 |
| - // since-cxx11-error@-1 {{type 'void ()' cannot be used prior to '::' because it has no members}} |
565 |
| - // since-cxx11-note@#cwg1584-h {{in instantiation of function template specialization 'cwg1584::h<void ()>' requested here}} |
566 |
| - template<typename T> void h(const T *); |
567 |
| - void i() { |
568 |
| - f(&i); |
569 |
| - // since-cxx11-error@-1 {{no matching function for call to 'f'}} |
570 |
| - // since-cxx11-note@#cwg1584-f {{candidate template ignored: could not match 'const T *' against 'void (*)()'}} |
571 |
| - g(&i); |
572 |
| - h(&i); // #cwg1584-h |
573 |
| - } |
574 |
| -#endif |
| 564 | +// Deducing function types from cv-qualified types |
| 565 | +template<typename T> void f(const T *); // #cwg1584-f |
| 566 | +template<typename T> void g(T *, const T * = 0); |
| 567 | +template<typename T> void h(T *) { T::error; } |
| 568 | +// expected-error@-1 {{type 'void ()' cannot be used prior to '::' because it has no members}} |
| 569 | +// expected-note@#cwg1584-h {{in instantiation of function template specialization 'cwg1584::h<void ()>' requested here}} |
| 570 | +template<typename T> void h(const T *); |
| 571 | +void i() { |
| 572 | + f(&i); |
| 573 | + // expected-error@-1 {{no matching function for call to 'f'}} |
| 574 | + // expected-note@#cwg1584-f {{candidate template ignored: could not match 'const T *' against 'void (*)()'}} |
| 575 | + g(&i); |
| 576 | + h(&i); // #cwg1584-h |
575 | 577 | }
|
576 | 578 |
|
| 579 | +template<typename T> struct tuple_size { |
| 580 | + static const bool is_primary = true; |
| 581 | +}; |
| 582 | +template<typename T> struct tuple_size<T const> : tuple_size<T> { |
| 583 | + static const bool is_primary = false; |
| 584 | +}; |
| 585 | + |
| 586 | +tuple_size<void()> t; |
| 587 | +static_assert(tuple_size<void()>::is_primary, ""); |
| 588 | +static_assert(tuple_size<void()const>::is_primary, ""); |
| 589 | +} // namespace cwg1584 |
| 590 | + |
577 | 591 | namespace cwg1589 { // cwg1589: 3.7 c++11
|
578 | 592 | #if __cplusplus >= 201103L
|
579 | 593 | // Ambiguous ranking of list-initialization sequences
|
|
0 commit comments