diff options
Diffstat (limited to 'gcc/testsuite/g++.dg')
44 files changed, 263 insertions, 47 deletions
diff --git a/gcc/testsuite/g++.dg/abi/macro0.C b/gcc/testsuite/g++.dg/abi/macro0.C index f6a57c1..3dd44fc 100644 --- a/gcc/testsuite/g++.dg/abi/macro0.C +++ b/gcc/testsuite/g++.dg/abi/macro0.C @@ -1,6 +1,6 @@ // This testcase will need to be kept in sync with c_common_post_options. // { dg-options "-fabi-version=0" } -#if __GXX_ABI_VERSION != 1020 +#if __GXX_ABI_VERSION != 1021 #error "Incorrect value of __GXX_ABI_VERSION" #endif diff --git a/gcc/testsuite/g++.dg/abi/ref-temp1.C b/gcc/testsuite/g++.dg/abi/ref-temp1.C index 70c9a7a..b02dcf6 100644 --- a/gcc/testsuite/g++.dg/abi/ref-temp1.C +++ b/gcc/testsuite/g++.dg/abi/ref-temp1.C @@ -7,11 +7,16 @@ struct B { const A (&x)[2]; }; template <typename T> B &&b = { { { { 1, 2, 3 } }, { { 4, 5, 6 } } } }; B &temp = b<void>; -// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE_" } } -// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE0_" } } -// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE1_" } } -// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE2_" } } +// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE_" { target { ! pe } } } } +// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE0_" { target { ! pe } } } } +// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE1_" { target { ! pe } } } } +// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE2_" { target { ! pe } } } } +// { dg-final { scan-assembler "\.section\t\.data\\\$_ZGR1bIvE_,\"w\"\n\t\.linkonce same_size" { target pe } } } +// { dg-final { scan-assembler "\.section\t\.rdata\\\$_ZGR1bIvE0_,\"dr\"\n\t\.linkonce same_size" { target pe } } } +// { dg-final { scan-assembler "\.section\t\.rdata\\\$_ZGR1bIvE1_,\"dr\"\n\t\.linkonce same_size" { target pe } } } +// { dg-final { scan-assembler "\.section\t\.rdata\\\$_ZGR1bIvE2_,\"dr\"\n\t\.linkonce same_size" { target pe } } } +// // { dg-final { scan-assembler "_ZGR1bIvE_:\n\[^\n]+_ZGR1bIvE0_" } } // { dg-final { scan-assembler "_ZGR1bIvE0_:\n\[^\n]+_ZGR1bIvE1_" } } // { dg-final { scan-assembler "_ZGR1bIvE1_:\n\[^\n]+\[ \t\]1" } } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice21.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice21.C index 4627365..dcc4044 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice21.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice21.C @@ -3,7 +3,7 @@ struct NoMut1 { int a, b; }; struct NoMut3 : virtual NoMut1 { - constexpr NoMut3(int a, int b) // { dg-error "virtual base" "" { target c++23 } } + constexpr NoMut3(int a, int b) : NoMut1{a, b} {} // { dg-error "virtual base" } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-noexcept1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-noexcept1.C new file mode 100644 index 0000000..d744556 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-noexcept1.C @@ -0,0 +1,10 @@ +// PR c++/119764 +// { dg-do compile { target c++11 } } +// { dg-additional-options "-fabi-version=0 -Wabi=20" } + +int main() { + const int x = 123; + auto a = [&]() { return x; }; + auto b = [&]() noexcept { return x; }; // { dg-warning "no longer captured" } + static_assert(sizeof(a) == sizeof(b), ""); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-diag2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-diag2.C new file mode 100644 index 0000000..93f3f10 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-diag2.C @@ -0,0 +1,12 @@ +// PR c++/113360 +// { dg-do compile { target c++14 } } + +constexpr bool init_list() // { dg-bogus "because" } +{ + int total{}; + for (int x : {1, 2, 3}) // { dg-error "initializer list" } + total += x; + return total == 6; +} + +static_assert(init_list(), ""); // { dg-error "constant" } diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-new.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-new.C index d0ca0b7..f4c6d2e 100644 --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-new.C +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-new.C @@ -6,7 +6,9 @@ constexpr int *f4(bool b) { return nullptr; } else { return new int{42}; // { dg-error "call to non-.constexpr." "" { target c++17_down } } - } // { dg-error "is not a constant expression because allocated storage has not been deallocated" "" { target c++2a } .-1 } + // { dg-message "allocated here" "" { target c++20 } .-1 } + } } static_assert(f4(true) == nullptr, ""); -static_assert(f4(false) == nullptr, ""); // { dg-error "non-.constant. condition|" } +static_assert(f4(false) == nullptr, ""); // { dg-error "non-constant condition" } +// { dg-error "is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } .-1 } diff --git a/gcc/testsuite/g++.dg/cpp1y/pr63996.C b/gcc/testsuite/g++.dg/cpp1y/pr63996.C index 8eee2e0..347c86c 100644 --- a/gcc/testsuite/g++.dg/cpp1y/pr63996.C +++ b/gcc/testsuite/g++.dg/cpp1y/pr63996.C @@ -1,5 +1,4 @@ // { dg-do compile { target c++14 } } -// { dg-additional-options "-Wno-return-type" } constexpr int foo (int i) @@ -8,4 +7,4 @@ foo (int i) if (i == 23) return 0; } -constexpr int j = foo (1); // { dg-error "flows off the end|in .constexpr. expansion of" } +constexpr int j = foo (1); diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-5.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-5.C index bcecea9..35beb27 100644 --- a/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-5.C +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-5.C @@ -28,7 +28,7 @@ struct M { constexpr K size () const { return {}; } constexpr L data () const { return {}; } }; #if __cpp_constexpr_dynamic_alloc >= 201907L struct N { constexpr int size () const { return 3; } - constexpr const char *data () const { return new char[3] { 'b', 'a', 'd' }; } }; // { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } } + constexpr const char *data () const { return new char[3] { 'b', 'a', 'd' }; } }; #endif constexpr const char a[] = { 't', 'e', 's', 't' }; struct O { constexpr int size () const { return 4; } @@ -117,6 +117,7 @@ foo () asm ((M {})); #if __cpp_constexpr_dynamic_alloc >= 201907L asm ((N {})); // { dg-error "constexpr string 'data\\\(\\\)\\\[0\\\]' must be a constant expression" "" { target c++20 } } + // { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } .-1 } #endif asm ((O {})); asm ((P (0))); @@ -190,6 +191,7 @@ bar () asm ((M {})); #if __cpp_constexpr_dynamic_alloc >= 201907L asm ((N {})); // { dg-error "constexpr string 'data\\\(\\\)\\\[0\\\]' must be a constant expression" "" { target c++20 } } + // { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } .-1 } #endif asm ((O {})); asm ((P (0))); diff --git a/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit18.C b/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit18.C index 8e230ef..f891814 100644 --- a/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit18.C +++ b/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit18.C @@ -24,7 +24,7 @@ f3 () } constexpr int -f4 () // { dg-message "declared here" "" { target c++20_down } } +f4 () { // { dg-message "is not usable as a 'constexpr' function because:" "" { target c++23 } .-1 } static const int a = f1 (1); // { dg-error "'a' defined 'static' in 'constexpr' function only available with" "" { target c++20_down } } return 0; // { dg-error "'a' defined 'static' in 'constexpr' context" "" { target c++23 } .-1 } diff --git a/gcc/testsuite/g++.dg/cpp26/pack-indexing2.C b/gcc/testsuite/g++.dg/cpp26/pack-indexing2.C index fdc8320..4a7e494 100644 --- a/gcc/testsuite/g++.dg/cpp26/pack-indexing2.C +++ b/gcc/testsuite/g++.dg/cpp26/pack-indexing2.C @@ -49,7 +49,7 @@ template<int N> int getT2 (auto... Ts) { - return Ts...[N]; // { dg-error "pack index is negative" } + return Ts...[N]; // { dg-error "pack index '-1' is negative" } } template<auto N, typename... Ts> @@ -63,7 +63,7 @@ template<auto N, typename... Ts> void badtype2 () { - Ts...[N] t; // { dg-error "pack index is out of range" } + Ts...[N] t; // { dg-error "pack index '1' is out of range for pack of length '1'" } } template<auto N, typename... Ts> @@ -77,7 +77,7 @@ template<auto N, typename... Ts> void badtype4 () { - Ts...[N] t; // { dg-error "pack index is negative" } + Ts...[N] t; // { dg-error "pack index '-1' is negative" } } int nonconst () { return 42; } diff --git a/gcc/testsuite/g++.dg/cpp26/static_assert1.C b/gcc/testsuite/g++.dg/cpp26/static_assert1.C index f9ac831..1d0e6f2 100644 --- a/gcc/testsuite/g++.dg/cpp26/static_assert1.C +++ b/gcc/testsuite/g++.dg/cpp26/static_assert1.C @@ -69,10 +69,11 @@ static_assert (false, M {}); // { dg-warning "'static_assert' with non-string me // { dg-error "static assertion failed: test" "" { target *-*-* } .-1 } #if __cpp_constexpr_dynamic_alloc >= 201907L struct N { constexpr int size () const { return 3; } - constexpr const char *data () const { return new char[3] { 'b', 'a', 'd' }; } }; // { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } } + constexpr const char *data () const { return new char[3] { 'b', 'a', 'd' }; } }; static_assert (true, N {}); // { dg-warning "'static_assert' with non-string message only available with" "" { target { c++20 && c++23_down } } } static_assert (false, N {}); // { dg-warning "'static_assert' with non-string message only available with" "" { target { c++20 && c++23_down } } } // { dg-error "constexpr string 'data\\\(\\\)\\\[0\\\]' must be a constant expression" "" { target c++20 } .-1 } + // { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } .-2 } #endif constexpr const char a[] = { 't', 'e', 's', 't' }; struct O { constexpr int size () const { return 4; } diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor16.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor16.C index b84aaf9..99d1307 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor16.C +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor16.C @@ -3,5 +3,5 @@ struct A { virtual ~A (); }; struct B : virtual A { constexpr ~B () {} }; -// { dg-error "'struct B' has virtual base classes" "" { target c++20 } .-1 } +// { dg-error "'constexpr' destructor in 'struct B' that has virtual base classes" "" { target c++20 } .-1 } // { dg-error "'constexpr' destructors only available with" "" { target c++17_down } .-2 } diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor7.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor7.C index 463eaca..f4546c1 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor7.C +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor7.C @@ -3,7 +3,7 @@ struct S { int *s; - constexpr S () : s(new int) {} // { dg-error "is not a constant expression because allocated storage has not been deallocated" } + constexpr S () : s(new int) {} S (const S &) = delete; S &operator= (const S &) = delete; constexpr ~S () { delete s; } @@ -17,3 +17,4 @@ foo (S v) } static_assert (foo (S ())); // { dg-error "non-constant condition for static assertion" } +// { dg-error "is not a constant expression because allocated storage has not been deallocated" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-dynamic10.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-dynamic10.C index f9f8223..e543ce4 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-dynamic10.C +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-dynamic10.C @@ -5,7 +5,7 @@ struct C { virtual void a(); }; struct B { virtual void b(); }; -struct A : virtual B, C { virtual void c(); }; // { dg-error ".struct A. has virtual base classes" } +struct A : virtual B, C { virtual void c(); }; // { dg-error "virtual base classes" } constexpr A a; // { dg-error "call" } diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new24.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new24.C index ee62f18..17c9f54 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-new24.C +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new24.C @@ -6,14 +6,14 @@ int a; constexpr char * f1 () { - constexpr auto p = new char[(long int) &a]; // { dg-error "size not constant" } + constexpr auto p = new char[(long int) &a]; // { dg-error "conversion from pointer" } return p; } constexpr char * f2 () { - auto p = new char[(long int) &a]; // { dg-error "size not constant" } + auto p = new char[(long int) &a]; // { dg-error "conversion from pointer" } return p; } diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new26.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new26.C index c82bd43..d8e53b2 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-new26.C +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new26.C @@ -4,7 +4,7 @@ constexpr int * f7 () { - int *p = new int (2); // { dg-error "is not a constant expression because it refers to a result of" } + int *p = new int (2); // { dg-message "allocated here" } delete p; return p; } @@ -12,6 +12,5 @@ f7 () void g () { - constexpr auto v7 = f7 (); + constexpr auto v7 = f7 (); // { dg-error "is not a constant expression because it refers to a result of" } } - diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C index 5d9f1925..30e453e 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C @@ -5,19 +5,19 @@ constexpr int * f1 () { - return new int (2); // { dg-error "is not a constant expression because it refers to a result of" } + return new int (2); // { dg-message "allocated here" } } -constexpr auto v1 = f1 (); +constexpr auto v1 = f1 (); // { dg-error "is not a constant expression because it refers to a result of" } constexpr bool f2 () { - int *p = new int (3); // { dg-error "is not a constant expression because allocated storage has not been deallocated" } + int *p = new int (3); // { dg-message "allocated here" } return false; } -constexpr auto v2 = f2 (); +constexpr auto v2 = f2 (); // { dg-error "is not a constant expression because allocated storage has not been deallocated" } constexpr bool f3 () @@ -64,12 +64,12 @@ constexpr auto v6 = f6 (); // { dg-message "in 'constexpr' expansion of" } constexpr int * f7 () { - int *p = new int (2); // { dg-error "is not a constant expression because it refers to a result of" } + int *p = new int (2); // { dg-message "allocated here" } delete p; return p; } -constexpr auto v7 = f7 (); +constexpr auto v7 = f7 (); // { dg-error "is not a constant expression because it refers to a result of" } constexpr bool f8_impl (int *p) diff --git a/gcc/testsuite/g++.dg/cpp2a/constinit14.C b/gcc/testsuite/g++.dg/cpp2a/constinit14.C index 06c4cb4..26d82fe67 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constinit14.C +++ b/gcc/testsuite/g++.dg/cpp2a/constinit14.C @@ -2,12 +2,13 @@ // { dg-do compile { target c++20 } } struct Value { - Value() : v{new int{42}} {} // { dg-error "result of 'operator new'" "" { target implicit_constexpr } } + Value() : v{new int{42}} {} int* v; }; struct S { static constinit inline Value v{}; // { dg-error "variable .S::v. does not have a constant initializer|call to non-.constexpr. function" } + // { dg-error "result of 'operator new'" "" { target implicit_constexpr } .-1 } }; int main() { return *S::v.v; } diff --git a/gcc/testsuite/g++.dg/eh/pr119507.C b/gcc/testsuite/g++.dg/eh/pr119507.C new file mode 100644 index 0000000..168779b --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/pr119507.C @@ -0,0 +1,21 @@ +// { dg-do compile { target comdat_group } } +// ARM EABI has its own exception handling data handling and does not use gcc_except_table +// { dg-skip-if "!TARGET_EXCEPTION_DATA" { arm_eabi } } +// Solaris/SPARC as uses a widely different COMDAT section syntax. +// { dg-skip-if "Solaris/SPARC as syntax" { sparc*-*-solaris2* && { ! gas } } } +// Force off function sections +// Force on exceptions +// { dg-options "-fno-function-sections -fexceptions" } +// PR middle-end/119507 + + +inline int comdat() { try { throw 1; } catch (int) { return 1; } return 0; } +int another_func_with_exception() { try { throw 1; } catch (int) { return 1; } return 0; } +inline int comdat1() { try { throw 1; } catch (int) { return 1; } return 0; } +int foo() { return comdat() + comdat1(); } + +// Make sure the gcc puts the exception table for both comdat and comdat1 in their own section +// { dg-final { scan-assembler-times ".section\[\t \]\[^\n\]*.gcc_except_table._Z6comdatv" 1 } } +// { dg-final { scan-assembler-times ".section\[\t \]\[^\n\]*.gcc_except_table._Z7comdat1v" 1 } } +// There should be 3 exception tables, +// { dg-final { scan-assembler-times ".section\[\t \]\[^\n\]*.gcc_except_table" 3 } } diff --git a/gcc/testsuite/g++.dg/ext/pragma-target2.C b/gcc/testsuite/g++.dg/ext/pragma-target2.C new file mode 100644 index 0000000..53eb7dd --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pragma-target2.C @@ -0,0 +1,18 @@ +// PR c++/114772 +// { dg-do compile { target x86_64-*-* } } + +template<typename V, bool STREAMING> +inline __attribute__((always_inline)) +__attribute__((warn_unused_result)) +int walk_document(V visitor) {return 0;} + +template<bool STREAMING> +void parse_document() { + int r = walk_document<bool, STREAMING>(false); +} + +void stage2_next() { + parse_document<true>(); +} + +#pragma GCC target("pclmul") diff --git a/gcc/testsuite/g++.dg/ext/type_pack_element2.C b/gcc/testsuite/g++.dg/ext/type_pack_element2.C index 1bf7753..1b07673 100644 --- a/gcc/testsuite/g++.dg/ext/type_pack_element2.C +++ b/gcc/testsuite/g++.dg/ext/type_pack_element2.C @@ -2,7 +2,7 @@ int p; -using type = __type_pack_element<&p, int>; // { dg-error "not an integral constant" } +using type = __type_pack_element<&p, int>; // { dg-error "non-integral type" } using type = __type_pack_element<1, int>; // { dg-error "out of range" } using type = __type_pack_element<2, int, char>; // { dg-error "out of range" } using type = __type_pack_element<-1, int>; // { dg-error "negative" } diff --git a/gcc/testsuite/g++.dg/ext/type_pack_element4.C b/gcc/testsuite/g++.dg/ext/type_pack_element4.C index aa508c7..5a39194 100644 --- a/gcc/testsuite/g++.dg/ext/type_pack_element4.C +++ b/gcc/testsuite/g++.dg/ext/type_pack_element4.C @@ -3,7 +3,7 @@ template <typename... _Elements> class tuple{}; template <unsigned long __i, typename... _Elements> -__type_pack_element<__i, _Elements...> &get(tuple<_Elements...> &__t) noexcept; // { dg-error "index is out of range" } +__type_pack_element<__i, _Elements...> &get(tuple<_Elements...> &__t) noexcept; // { dg-error "out of range" } tuple<int,int> data; template <unsigned long Level> unsigned take_impl(unsigned idx) { diff --git a/gcc/testsuite/g++.dg/gcov/gcov.exp b/gcc/testsuite/g++.dg/gcov/gcov.exp index 50f60c4..04c7c95 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov.exp +++ b/gcc/testsuite/g++.dg/gcov/gcov.exp @@ -21,12 +21,19 @@ load_lib g++-dg.exp load_lib gcov.exp global GXX_UNDER_TEST +global GCOV_UNDER_TEST -# Find gcov in the same directory as $GXX_UNDER_TEST. -if { ![is_remote host] && [string match "*/*" [lindex $GXX_UNDER_TEST 0]] } { - set GCOV [file dirname [lindex $GXX_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] +# Find gcov in the same directory as $GXX_UNDER_TEST, unless +# GCOV_UNDER_TEST is defined. + +if ![info exists GCOV_UNDER_TEST] { + if { ![is_remote host] && [string match "*/*" [lindex $GXX_UNDER_TEST 0]] } { + set GCOV [file dirname [lindex $GXX_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] + } else { + set GCOV [gcc-transform-out-of-tree gcov] + } } else { - set GCOV [gcc-transform-out-of-tree gcov] + set GCOV $GCOV_UNDER_TEST } # Initialize harness. diff --git a/gcc/testsuite/g++.dg/ipa/pr83549.C b/gcc/testsuite/g++.dg/ipa/pr83549.C index 90cf8fe..3b4547b 100644 --- a/gcc/testsuite/g++.dg/ipa/pr83549.C +++ b/gcc/testsuite/g++.dg/ipa/pr83549.C @@ -1,5 +1,6 @@ // PR ipa/83549 // { dg-do compile } +// { dg-require-effective-target variadic_mi_thunk } // { dg-options "-O2" } struct A { virtual ~A (); }; diff --git a/gcc/testsuite/g++.dg/ipa/pr83667.C b/gcc/testsuite/g++.dg/ipa/pr83667.C index a8a5a5a..ec91a2e 100644 --- a/gcc/testsuite/g++.dg/ipa/pr83667.C +++ b/gcc/testsuite/g++.dg/ipa/pr83667.C @@ -1,6 +1,7 @@ // { dg-require-alias "" } // { dg-options "-fdump-ipa-inline" } // c++/83667 ICE dumping a static thunk when TARGET_USE_LOCAL_THUNK_ALIAS_P +// { dg-require-effective-target variadic_mi_thunk } struct a diff --git a/gcc/testsuite/g++.dg/modules/concept-11_a.H b/gcc/testsuite/g++.dg/modules/concept-11_a.H new file mode 100644 index 0000000..4512768 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/concept-11_a.H @@ -0,0 +1,9 @@ +// PR c++/119939 +// { dg-additional-options "-fmodule-header -std=c++20" } +// { dg-module-cmi {} } + +template <typename T> concept A = true; +template <typename T> concept B = requires { T{}; }; +template <typename T> struct S { + friend bool operator==(const S&, const S&) requires B<T> = default; +}; diff --git a/gcc/testsuite/g++.dg/modules/concept-11_b.C b/gcc/testsuite/g++.dg/modules/concept-11_b.C new file mode 100644 index 0000000..3f6676f --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/concept-11_b.C @@ -0,0 +1,9 @@ +// PR c++/119939 +// { dg-additional-options "-fmodules -std=c++20" } + +import "concept-11_a.H"; + +int main() { + S<int> s; + s == s; +} diff --git a/gcc/testsuite/g++.dg/modules/tpl-friend-18_a.C b/gcc/testsuite/g++.dg/modules/tpl-friend-18_a.C new file mode 100644 index 0000000..333c976 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tpl-friend-18_a.C @@ -0,0 +1,25 @@ +// PR c++/119863 +// { dg-additional-options "-fmodules" } +// { dg-module-cmi A } + +export module A; + +template<typename> +class T; + +template<typename> +class U +{ + template<typename> + friend class T; +}; + +template<typename V> +class T +{ + U<V> x = {}; +}; + +export +template<typename V> +T<V> f(V) { return {}; } diff --git a/gcc/testsuite/g++.dg/modules/tpl-friend-18_b.C b/gcc/testsuite/g++.dg/modules/tpl-friend-18_b.C new file mode 100644 index 0000000..2e537ed --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tpl-friend-18_b.C @@ -0,0 +1,9 @@ +// PR c++/119863 +// { dg-additional-options "-fmodules" } +// { dg-module-cmi B } + +export module B; + +// this should not be considered conflicting +template <typename> +class T; diff --git a/gcc/testsuite/g++.dg/modules/tpl-friend-18_c.C b/gcc/testsuite/g++.dg/modules/tpl-friend-18_c.C new file mode 100644 index 0000000..6c8d85b --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tpl-friend-18_c.C @@ -0,0 +1,10 @@ +// PR c++/119863 +// { dg-additional-options "-fmodules" } + +import A; +import B; + +int main() +{ + auto const x = f(1); +} diff --git a/gcc/testsuite/g++.dg/musttail8.C b/gcc/testsuite/g++.dg/musttail8.C index 0f1b68b..18de9c8 100644 --- a/gcc/testsuite/g++.dg/musttail8.C +++ b/gcc/testsuite/g++.dg/musttail8.C @@ -1,4 +1,4 @@ -/* { dg-do compile { target { musttail } } } */ +/* { dg-do compile { target { musttail && { ! using_sjlj_exceptions } } } } */ /* { dg-options "-std=gnu++11" } */ /* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */ diff --git a/gcc/testsuite/g++.dg/musttail9.C b/gcc/testsuite/g++.dg/musttail9.C index 85937dc..1c3a744 100644 --- a/gcc/testsuite/g++.dg/musttail9.C +++ b/gcc/testsuite/g++.dg/musttail9.C @@ -1,4 +1,4 @@ -/* { dg-do compile { target { musttail } } } */ +/* { dg-do compile { target { musttail && { ! using_sjlj_exceptions } } } } */ /* { dg-options "-std=gnu++11" } */ /* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */ diff --git a/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C b/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C index 147c2b7..b858d70 100644 --- a/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C +++ b/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C @@ -6,6 +6,7 @@ /* { dg-additional-options "-fno-PIE" { target ia32 } } */ /* { dg-do compile { target { ! hppa*-*-* } } } */ +/* { dg-require-effective-target fstack_protector } */ int __attribute__((no_stack_protector)) foo() { diff --git a/gcc/testsuite/g++.dg/opt/musttail3.C b/gcc/testsuite/g++.dg/opt/musttail3.C index 1c4e549..a2db447 100644 --- a/gcc/testsuite/g++.dg/opt/musttail3.C +++ b/gcc/testsuite/g++.dg/opt/musttail3.C @@ -1,5 +1,5 @@ // PR tree-optimization/119491 -// { dg-do compile { target { external_musttail && c++11 } } } +// { dg-do compile { target { external_musttail && { c++11 && { ! using_sjlj_exceptions } } } } } // { dg-options "-O2" } struct A { diff --git a/gcc/testsuite/g++.dg/opt/musttail4.C b/gcc/testsuite/g++.dg/opt/musttail4.C index ede2959..3362ccc 100644 --- a/gcc/testsuite/g++.dg/opt/musttail4.C +++ b/gcc/testsuite/g++.dg/opt/musttail4.C @@ -1,4 +1,4 @@ -// { dg-do compile { target { external_musttail && c++11 } } } +// { dg-do compile { target { external_musttail && { c++11 && { ! using_sjlj_exceptions } } } } } // { dg-options "-O2 -fexceptions" } struct S { ~S (); }; diff --git a/gcc/testsuite/g++.dg/opt/musttail5.C b/gcc/testsuite/g++.dg/opt/musttail5.C index 604dd69..10e8d94 100644 --- a/gcc/testsuite/g++.dg/opt/musttail5.C +++ b/gcc/testsuite/g++.dg/opt/musttail5.C @@ -1,5 +1,5 @@ // PR tree-optimization/119491 -// { dg-do compile { target { external_musttail && c++11 } } } +// { dg-do compile { target { external_musttail && { c++11 && { ! using_sjlj_exceptions } } } } } // { dg-options "-O2" } struct A { diff --git a/gcc/testsuite/g++.dg/opt/pr119327.C b/gcc/testsuite/g++.dg/opt/pr119327.C new file mode 100644 index 0000000..598ae1c --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr119327.C @@ -0,0 +1,16 @@ +// PR target/119327 +// { dg-do compile { target c++11 } } +// { dg-options "-Os" } + +#pragma GCC optimize "fp-contract=off" + +template <class T> +void +foo (T f) +{ + f (); +} + +struct S { + S () { [] {}; foo ([] __attribute__((always_inline)) {}); } +} s; diff --git a/gcc/testsuite/g++.dg/opt/pr119613.C b/gcc/testsuite/g++.dg/opt/pr119613.C index 2ced2e8..c3657eb 100644 --- a/gcc/testsuite/g++.dg/opt/pr119613.C +++ b/gcc/testsuite/g++.dg/opt/pr119613.C @@ -1,5 +1,5 @@ // PR middle-end/119613 -// { dg-do compile { target { musttail && c++11 } } } +// { dg-do compile { target { musttail && { c++11 && { ! using_sjlj_exceptions } } } } } // { dg-options "-O0" } struct S { S () {} }; diff --git a/gcc/testsuite/g++.dg/pr112822.C b/gcc/testsuite/g++.dg/pr112822.C index a855752..f88bd83 100644 --- a/gcc/testsuite/g++.dg/pr112822.C +++ b/gcc/testsuite/g++.dg/pr112822.C @@ -89,7 +89,7 @@ template <typename aj, typename cm> struct cg<aj, cm> { typedef aj cn; }; namespace ai { template <typename cj, int> cj cp; template <typename bu, typename cj, int> void cl(bu *cr, cj cs) { ct(cr, cs); } -typedef __attribute__((altivec(vector__))) double co; +typedef double co __attribute__ ((vector_size (16))); void ct(double *cr, co cs) { *(co *)cr = cs; } struct cq { co q; diff --git a/gcc/testsuite/g++.dg/template/explicit-args6.C b/gcc/testsuite/g++.dg/template/explicit-args6.C index 18663d7b..0d9718c 100644 --- a/gcc/testsuite/g++.dg/template/explicit-args6.C +++ b/gcc/testsuite/g++.dg/template/explicit-args6.C @@ -24,10 +24,12 @@ frob() // narrowing check, reject negative values return unsigned{N}; // { dg-prune-output "narrowing" } -} // { dg-prune-output "flows off the end" } -// { dg-prune-output "not a return-statement" } +} -template<int N> void get_n(tuple& t) { get<frob<N>()>(t); } // { dg-error "" } +// This complains about calling frob only in C++11 because +// maybe_save_constexpr_fundef fails; in later standards it succeeds, +// and the evaluation failure is silent due to the earlier errors. +template<int N> void get_n(tuple& t) { get<frob<N>()>(t); } // { dg-error "" "" { target c++11_only } } int main() { diff --git a/gcc/testsuite/g++.dg/template/recurse5.C b/gcc/testsuite/g++.dg/template/recurse5.C new file mode 100644 index 0000000..7bfe523 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/recurse5.C @@ -0,0 +1,17 @@ +// Test that we don't bother to instantiate add since there were errors in +// checked_add. + +template <class T> T add (T t) { return t+1; } // { dg-bogus "no match" } + +template <class T> T checked_add (T t) +{ + add (t); + return t+1; // { dg-error "no match" } +} + +struct A { }; + +int main() +{ + checked_add (A()); +} diff --git a/gcc/testsuite/g++.dg/torture/pr119610.C b/gcc/testsuite/g++.dg/torture/pr119610.C new file mode 100644 index 0000000..9998026 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr119610.C @@ -0,0 +1,18 @@ +// { dg-do run } +// { dg-additional-options "-fstack-protector-strong" { target fstack_protector } } +// { dg-additional-options "-fstack-clash-protection" { target supports_stack_clash_protection } } + +int *ptr; +void foo() { + int c[1024*128]; + ptr = c; + throw 1; +} +int main() +{ + try { + foo(); + } catch(int x) { + return 0; + } +} diff --git a/gcc/testsuite/g++.dg/torture/pr81812.C b/gcc/testsuite/g++.dg/torture/pr81812.C index b5c621d..80aed8e 100644 --- a/gcc/testsuite/g++.dg/torture/pr81812.C +++ b/gcc/testsuite/g++.dg/torture/pr81812.C @@ -1,4 +1,5 @@ // { dg-xfail-if "PR108277" { arm_thumb1 } } +// { dg-require-effective-target variadic_mi_thunk } struct Error { virtual void error(... ) const; diff --git a/gcc/testsuite/g++.dg/warn/Wformat-3.C b/gcc/testsuite/g++.dg/warn/Wformat-3.C new file mode 100644 index 0000000..e308530 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wformat-3.C @@ -0,0 +1,19 @@ +// PR c++/116954 +// { dg-additional-options -Wformat } + +#ifndef WORKS +template<int N> +int fn(char (&buf)[N], const char fmt[], ...) + __attribute__ ((__format__ (__printf__, 2, 3))); +#endif + +template<int N> +__attribute__ ((__format__ (__printf__, 2, 3))) +int fn(char (&)[N], const char [], ...) +{ return 0; } + +int main() +{ + char buf[20]; + return fn(buf, "%s", 42); /* { dg-warning "Wformat" } */ +} |