diff --git a/src/cmd_line.c b/src/cmd_line.c index 7ebc1d8edb..4c8fe67f82 100644 --- a/src/cmd_line.c +++ b/src/cmd_line.c @@ -4301,6 +4301,13 @@ default mode (e.g., exception handling). std_override_modifiers_enabled = value; constexpr_implies_const = value; register_is_deprecated = TRUE; + if (value && rvalue_references_enabled && + (cpp14_mode || gpp_mode || clang_mode) && + !gpp_version_is(<90000) && !clangcpp_version_is(<40000)) { + /* A field selection on a class prvalue is an xvalue (CWG 616). GCC 9+ + and Clang 4+ also do that in C++11 mode. */ + selection_from_prvalue_is_xvalue = TRUE; + } /* if */ if (cpp14_mode) { /* Features enabled in C++14 mode. */ if (auto_type_specifier_enabled) { @@ -4317,9 +4324,6 @@ default mode (e.g., exception handling). if (!option_kind_used[(int)optk_digit_separators]) { digit_separators_enabled = TRUE; } /* if */ - if (rvalue_references_enabled && !gpp_mode && !clang_mode) { - selection_from_prvalue_is_xvalue = TRUE; - } /* if */ relaxed_constexpr_enabled = TRUE; sized_deallocation_enabled = RUNTIME_SUPPORTS_SIZED_DEALLOCATION; if (gpp_mode && !clang_mode && gnu_version < 50000) { diff --git a/src/cmd_line.h b/src/cmd_line.h index 3c10c68899..170d699b60 100644 --- a/src/cmd_line.h +++ b/src/cmd_line.h @@ -1742,7 +1742,8 @@ EXTERN_THREAD a_boolean EXTERN_THREAD a_boolean selection_from_prvalue_is_xvalue; /* TRUE if a field selection on a prvalue class object - produces an xvalue (C++14 / CWG 616). When FALSE, + produces an xvalue (C++14 / CWG 616; GCC 9 and + Clang 4 also apply it in C++11 mode). When FALSE, the selection is a prvalue. */ EXTERN_THREAD a_boolean diff --git a/src/exprutil.c b/src/exprutil.c index 22c7df63d3..af7ed5fb67 100644 --- a/src/exprutil.c +++ b/src/exprutil.c @@ -25481,6 +25481,13 @@ underlying entity is a temporary, return *is_temp set to TRUE. clear_expr_or_stmt_traversal_block(&tblock); tblock.process_expr = examine_expr_for_auto_object; tblock.follow_addressing_path = TRUE; + /* A pointer into a prvalue.field xvalue (CWG 616) addresses a + subobject of the class prvalue, which is a temporary even when it + is not represented by an explicit temporary (e.g., for a trivially + destructible class). */ + tblock.follow_class_rvalue_addressing_path = + selection_from_prvalue_is_xvalue; + tblock.look_for_temporaries = selection_from_prvalue_is_xvalue; traverse_expr(expr, &tblock); is_addr_of_auto = tblock.result; *is_temp = tblock.is_temp; diff --git a/src/il_walk.c b/src/il_walk.c index 4a0d7cbc30..74ec1af210 100644 --- a/src/il_walk.c +++ b/src/il_walk.c @@ -3267,10 +3267,10 @@ Tips for proper use of the follow_addressing_path mode: switch (op) { case eok_dot_field: /* x.y: Follow x. */ - /* We don't have to test for the prvalue.field case here because its - result is a prvalue and therefore wouldn't get here, unless - follow_class_rvalue_addressing_path is TRUE, in which case - we want to keep going anyway. */ + /* We don't have to test for the prvalue.field case here: it gets + here only if follow_class_rvalue_addressing_path is TRUE or if + its result is an xvalue (selection_from_prvalue_is_xvalue, + CWG 616), and in both cases we want to keep going. */ traverse_expr(operand1, tblock); break; case eok_points_to_field: @@ -3279,10 +3279,10 @@ Tips for proper use of the follow_addressing_path mode: break; case eok_pm_field: /* x.*pm: Follow x. */ - /* We don't have to test for the prvalue.*pm case here because its - result is a prvalue and therefore wouldn't get here, unless - follow_class_rvalue_addressing_path is TRUE, in which case - we want to keep going anyway. */ + /* We don't have to test for the prvalue.*pm case here: it gets + here only if follow_class_rvalue_addressing_path is TRUE or if + its result is an xvalue (selection_from_prvalue_is_xvalue, + CWG 616), and in both cases we want to keep going. */ traverse_expr(operand1, tblock); break; case eok_pm_points_to_field: diff --git a/src/il_walk.h b/src/il_walk.h index 734c3b7515..b93f365ad7 100644 --- a/src/il_walk.h +++ b/src/il_walk.h @@ -387,7 +387,8 @@ typedef struct an_expr_or_stmt_traversal_block { /* TRUE if expr_complete_object_type was called to determine the object type for a virtual function call. */ - /* Fields used by is_glvalue_for_auto_object: */ + /* Fields used by is_glvalue_for_auto_object and + is_address_of_auto_object: */ a_boolean is_temp; /* TRUE if the underlying object is a temporary. */ a_boolean look_for_temporaries; diff --git a/src/interpret.c b/src/interpret.c index eb9c769d5a..67c8b4ec5c 100644 --- a/src/interpret.c +++ b/src/interpret.c @@ -4887,6 +4887,36 @@ object) is initialized. } /* subobject_is_initialized */ +#if GNU_VECTOR_TYPES_ALLOWED +static a_boolean vector_elements_are_initialized( + an_interpreter_state *ips, + a_type_ptr tp, + a_constexpr_address *cap) +/* +Return TRUE if each element of the vector of type tp at the address described +by *cap is initialized (or if the enclosing complete object is fully +initialized). The elements of a vector are tracked individually, so a whole +vector value can only be read if none of them is uninitialized. +*/ +{ + a_boolean result = TRUE; + + if (!complete_object_is_initialized(cap->complete_object)) { + a_type_ptr etp = skip_typerefs(tp->variant.vector.element_type); + a_targ_size_t k, n_elems = num_vector_elements(tp); + a_byte_count elem_size = value_bytes_for_type(ips, etp, &result); + for (k = 0; result && kaddress+k*elem_size, + cap->complete_object)) { + result = FALSE; + } /* if */ + } /* for */ + } /* if */ + return result; +} /* vector_elements_are_initialized */ +#endif /* GNU_VECTOR_TYPES_ALLOWED */ + + static a_boolean mark_mutable_members_not_initialized( an_interpreter_state *ips, a_byte *subobj, @@ -7483,6 +7513,15 @@ END_DISABLE_GCC_WARNING_STR_OVERFLOW unmap_stack_bytes(ips, dst_addr.address); } /* if */ mark_subobject_initialized(dst_addr.address, complete_object); +#if GNU_VECTOR_TYPES_ALLOWED + if (type_is(ftp, tk_vector)) { + /* A vector element can be accessed by itself (e.g., by + subscripting the member), so mark each element + initialized. */ + mark_whole_subobject_initialized(ips, dst_addr.address, ftp, + complete_object); + } /* if */ +#endif /* GNU_VECTOR_TYPES_ALLOWED */ elem_con = elem_con->next; } /* if */ if (this_bytes != NULL) { @@ -7818,6 +7857,25 @@ any subobject that is not initialized (the diagnostic is associated with pos). } /* if */ } break; +#if GNU_VECTOR_TYPES_ALLOWED + case tk_vector: + { /* The elements of a vector are tracked individually: Handle each + element after the first (which shares the address of the vector + and was handled above). */ + a_type_ptr etp = skip_typerefs(tp->variant.vector.element_type); + a_targ_size_t k, n_elems = num_vector_elements(tp); + a_byte_count elem_size = value_bytes_for_type(ips, etp, &result); + for (k = 1; result && kvariant.constructor.value_initialization) { - /* If this is for value initialization, clear the storage first. - Do not, however, overwrite the first word (which may record the - inheritance hierarchy). */ + if (!dip->variant.constructor.value_initialization) { + /* Nothing to do. */ + } else if (!type_has_user_provided_default_constructor(class_type)) { + /* Value initialization of a class without a user-provided default + constructor zero-initializes the object before calling the + constructor, which need not initialize every subobject (e.g., a + member of a class whose implicit default constructor calls a + user-provided base class constructor). Mark the subobjects as + initialized, so that reading them is valid. */ + init_subobject_to_zero(ips, result_storage, class_type, + complete_object); + } else { + /* Otherwise, the object is not zero-initialized, but clear the + storage anyway. Do not, however, overwrite the first word (which + may record the inheritance hierarchy). */ a_byte_count n_class_bytes; a_boolean dummy = TRUE; n_class_bytes = f_value_bytes_for_type(ips, class_type, &dummy); @@ -25465,6 +25534,14 @@ conversion to an rvalue is forced externally. } else if (!is_initialized(cap) && !is_immediate_class_type(tp)) { do_constexpr_fail(result); info_with_pos(ec_object_not_initialized, &expr->position, ips); +#if GNU_VECTOR_TYPES_ALLOWED + } else if (type_is(tp, tk_vector) && + !vector_elements_are_initialized(ips, tp, cap)) { + /* A whole vector is read, but some of its elements are not + initialized. */ + do_constexpr_fail(result); + info_with_pos(ec_object_not_initialized, &expr->position, ips); +#endif /* GNU_VECTOR_TYPES_ALLOWED */ } else if (is_variant_path(cap) && !check_variant_path(ips, cap, &expr->position)) { /* An attempt to dereference an inactive variant path. */ @@ -32204,7 +32281,7 @@ the value representation of the integer value. break; #if GNU_VECTOR_TYPES_ALLOWED case eok_vector_subscript: - /* The first operand is a vector (lvalue or rvalue), and the + /* The first operand is a vector (glvalue or prvalue), and the second operand is an integer. */ { a_host_large_integer len = (a_host_large_integer) num_vector_elements(opnd1_type); @@ -32223,7 +32300,7 @@ the value representation of the integer value. etp = skip_typerefs(opnd1_type->variant.vector.element_type); esize = value_bytes_for_type(ips, etp, &result); if (!result) break; - if (opnd1->is_lvalue) { + if (opnd1->is_lvalue || opnd1->is_xvalue) { a_constexpr_address result_addr = *(a_constexpr_address*)opnd1_value; result_addr.address += host_int_val*esize; @@ -32250,8 +32327,9 @@ the value representation of the integer value. result_addr = *(a_constexpr_address*)opnd1_value; } else { /* The first operand is a class rvalue: Create an address for - it. */ - mark_complete_object_initialized(opnd1_value); + it. Do not mark the object as fully initialized: since + C++20, a constexpr constructor can leave members + uninitialized, and reading those must be diagnosed. */ clear_address(&result_addr, opnd1_value); result_addr.alloc_seq_number = ips->storage_stack.alloc_seq(); } /* if */ @@ -32375,8 +32453,9 @@ the value representation of the integer value. result_addr = *(a_constexpr_address*)opnd1_value; } else { /* The first operand is a class rvalue: Create an address for - it. */ - mark_complete_object_initialized(opnd1_value); + it. Do not mark the object as fully initialized: since + C++20, a constexpr constructor can leave members + uninitialized, and reading those must be diagnosed. */ clear_address(&result_addr, opnd1_value); result_addr.alloc_seq_number = ips->storage_stack.alloc_seq(); } /* if */ @@ -33129,6 +33208,16 @@ the value representation of the integer value. &expr->position, ips); } /* switch */ done: +#if GNU_VECTOR_TYPES_ALLOWED + if (pop_when_done && result && type_is(tp, tk_vector) && + !is_glvalue_node(expr)) { + /* The whole vector value has been stored, and its elements can be + accessed individually (e.g., by subscripting an lvalue for it), so + mark each of them initialized. */ + mark_whole_subobject_initialized(ips, result_storage, tp, + complete_object); + } /* if */ +#endif /* GNU_VECTOR_TYPES_ALLOWED */ end_work_visit(ips, result, pop_when_done); #undef SET_result_val_from_operand_address #undef CHECK_int_range diff --git a/src/pending_changes/gh-90-lifetime-extension-member-of-temporary.txt b/src/pending_changes/gh-90-lifetime-extension-member-of-temporary.txt new file mode 100644 index 0000000000..787dcdf835 --- /dev/null +++ b/src/pending_changes/gh-90-lifetime-extension-member-of-temporary.txt @@ -0,0 +1,40 @@ +[GH #90] +GNU and Clang C++ modes: lifetime extension through a member of a temporary + +When emulating GCC 9 or later or Clang 4 or later (in C++11 and later +modes), selecting a member of a class prvalue now produces an xvalue (Core +issue 616), as it already did in standard C++14 and later modes. Binding a +reference to the member now extends the lifetime of the whole temporary. +For example, with --g++ --gnu_version=150000: + + struct A { int b; ~A(); }; + const int &r = A().b; // A() was previously destroyed here. + +Returning a pointer into a member of a class prvalue is now diagnosed also +when the class is trivially destructible. For example, with --c++20: + + struct T { int b; int arr[2]; }; + T make(); + const int *f() { return &make().arr[1]; } // Warning. + +Constant evaluation also no longer treats every member of a class prvalue +as initialized when one is selected with "." or ".*". Since C++20, a +constexpr constructor can leave members uninitialized, and reading such a +member is now diagnosed instead of producing an indeterminate value. For +example, with --c++20: + + struct W { int n; constexpr W() {} }; + static_assert(W().n == 0); // Error: n is uninitialized. + +Constant evaluation now also marks each element of a GNU vector as +initialized when a whole vector value is stored (e.g., by a mem-initializer), +and copies the state of each element when an object containing a vector is +copied. Subscripting such a vector could previously give a spurious "access +to uninitialized object" error. Conversely, reading or copying a whole +vector subobject now requires each of its elements to be initialized. For +example, with --g++ --c++20: + + typedef int V4 __attribute__((vector_size(16))); + struct Y { V4 v; constexpr Y(V4 a) : v(a) {} }; + constexpr int f() { V4 a = {1, 2, 3, 4}; Y y(a); return y.v[3]; } + static_assert(f() == 4, ""); // Previously rejected. diff --git a/src/pending_changes/gh-90-value-init-zeroed-members.txt b/src/pending_changes/gh-90-value-init-zeroed-members.txt new file mode 100644 index 0000000000..83eb26ed53 --- /dev/null +++ b/src/pending_changes/gh-90-value-init-zeroed-members.txt @@ -0,0 +1,12 @@ +[GH #90] +Constexpr reads of zero-initialized members after value initialization + +Value initialization of a class without a user-provided default constructor +zero-initializes the object before calling the constructor. During +constant evaluation, the zeroed members were not treated as initialized, so +reading one that the constructor does not set was rejected. For example, +with --c++20: + + struct A { constexpr A() {} int x; }; + struct B : A { int y; }; + static_assert(B().x == 0); // Previously rejected. diff --git a/tests/expectations/edg_x86_64/imported.log b/tests/expectations/edg_x86_64/imported.log index fbbfdb7f73..acd4ad66ce 100644 --- a/tests/expectations/edg_x86_64/imported.log +++ b/tests/expectations/edg_x86_64/imported.log @@ -6601,7 +6601,6 @@ gnu/cpp/cpp0x/constexpr-typeid/test.mft.cpp:fn:-DTEST_NUMBER=1 --c++11:FAIL: gnu/cpp/cpp0x/conv-tmpl1.sft.cpp:fp:-DTEST_NUMBER=1 --c++11:FAIL: gnu/cpp/cpp0x/conv-tmpl6.sft.cpp:fp:-DTEST_NUMBER=1 --c++11:FAIL: gnu/cpp/cpp0x/decltype41/test.mft.cpp:fp:-DTEST_NUMBER=1 --c++11:FAIL: -gnu/cpp/cpp0x/decltype72.sft.cpp:fp:-DTEST_NUMBER=1 --c++11:FAIL: gnu/cpp/cpp0x/decltype80.sft.cpp:fn:-DTEST_NUMBER=1 --c++11:FAIL: gnu/cpp/cpp0x/decltype83.sft.cpp:fp:-DTEST_NUMBER=1 --c++11:ABORT: gnu/cpp/cpp0x/decltype83a.sft.cpp:fp:-DTEST_NUMBER=1 --c++11:ABORT: @@ -7066,7 +7065,6 @@ gnu/cpp/cpp2a/consteval13.sft.cpp:fp:-DTEST_NUMBER=1 --c++20:FAIL: gnu/cpp/cpp2a/consteval25.sft.cpp:fp:-DTEST_NUMBER=1 --c++20:FAIL: gnu/cpp/cpp2a/consteval32.sft.cpp:fn:-DTEST_NUMBER=1 --c++20:FAIL: gnu/cpp/cpp2a/constexpr-99287.sft.cpp:fp:-DTEST_NUMBER=1 --c++20:FAIL: -gnu/cpp/cpp2a/constexpr-init18.sft.cpp:fp:-DTEST_NUMBER=1 --c++20:FAIL: gnu/cpp/cpp2a/constexpr-inst1.sft.cpp:fn:-DTEST_NUMBER=1 --c++14:FAIL: gnu/cpp/cpp2a/constexpr-inst2.sft.cpp:fp:-DTEST_NUMBER=1 --c++11:FAIL: gnu/cpp/cpp2a/constexpr-new11/test.mft.cpp:fp:-DTEST_NUMBER=1 --c++20:FAIL: @@ -7742,7 +7740,6 @@ gnu/cpp/init/new22.sft.cpp:fn:-DTEST_NUMBER=1:FAIL: gnu/cpp/init/new39.sft.cpp:rp:-DTEST_NUMBER=1:FAIL: gnu/cpp/init/new40.sft.cpp:rp:-DTEST_NUMBER=1:FAIL: gnu/cpp/init/null1.sft.cpp:fp:-DTEST_NUMBER=1 --c++11:FAIL: -gnu/cpp/init/ref19.sft.cpp:rp:-DTEST_NUMBER=1:FAIL: gnu/cpp/init/ref23.sft.cpp:fp:-DTEST_NUMBER=1:FAIL: gnu/cpp/init/reference2.sft.cpp:fn:-DTEST_NUMBER=1:FAIL: gnu/cpp/init/self1.sft.cpp:fn:-DTEST_NUMBER=1 --c++11:FAIL: diff --git a/tests/tests/cwg/.cwg616.rto/default.1.1.txt b/tests/tests/cwg/.cwg616.rto/default.1.1.txt new file mode 100644 index 0000000000..b921d6c913 --- /dev/null +++ b/tests/tests/cwg/.cwg616.rto/default.1.1.txt @@ -0,0 +1 @@ +fe_only -DTEST_NUMBER=1 --c++14 Test_name.c diff --git a/tests/tests/cwg/.cwg616.rto/default.2.1.txt b/tests/tests/cwg/.cwg616.rto/default.2.1.txt new file mode 100644 index 0000000000..fe264f46a7 --- /dev/null +++ b/tests/tests/cwg/.cwg616.rto/default.2.1.txt @@ -0,0 +1 @@ +fe_only -DTEST_NUMBER=2 --c++14 --g++ --gnu_version=150000 Test_name.c diff --git a/tests/tests/cwg/.cwg616.rto/default.3.1.txt b/tests/tests/cwg/.cwg616.rto/default.3.1.txt new file mode 100644 index 0000000000..8d04c2fe9a --- /dev/null +++ b/tests/tests/cwg/.cwg616.rto/default.3.1.txt @@ -0,0 +1 @@ +fe_only -DTEST_NUMBER=3 --c++14 --clang --clang_version=190100 Test_name.c diff --git a/tests/tests/cwg/.cwg616.rto/default.4.1.txt b/tests/tests/cwg/.cwg616.rto/default.4.1.txt new file mode 100644 index 0000000000..ecba2fee1d --- /dev/null +++ b/tests/tests/cwg/.cwg616.rto/default.4.1.txt @@ -0,0 +1 @@ +fe_only -DTEST_NUMBER=4 --c++11 --g++ --gnu_version=90000 Test_name.c diff --git a/tests/tests/cwg/.cwg616.rto/default.5.1.txt b/tests/tests/cwg/.cwg616.rto/default.5.1.txt new file mode 100644 index 0000000000..b0b23c3e80 --- /dev/null +++ b/tests/tests/cwg/.cwg616.rto/default.5.1.txt @@ -0,0 +1 @@ +fe_only -DTEST_NUMBER=5 --c++11 --clang --clang_version=40000 Test_name.c diff --git a/tests/tests/cwg/cwg616.sft.cpp b/tests/tests/cwg/cwg616.sft.cpp new file mode 100644 index 0000000000..d3fbbd327d --- /dev/null +++ b/tests/tests/cwg/cwg616.sft.cpp @@ -0,0 +1,13 @@ +//type:fp +//options:--c++14:--c++14 --g++ --gnu_version=150000:--c++14 --clang --clang_version=190100:--c++11 --g++ --gnu_version=90000:--c++11 --clang --clang_version=40000 +template struct is_xvalue { static const bool value = false; }; +template struct is_xvalue { static const bool value = true; }; +struct A { int b; }; +// Selecting a member of a class prvalue produces an xvalue. +static_assert(is_xvalue::value, ""); +static_assert(is_xvalue::value, ""); + +//cwg: 616 +//title: Definition of "indeterminate value" +//meeting: Bristol 4/13 +//edg_status: Passes diff --git a/tests/tests/imported/clang/c/C/C11/.n1285.rto/default.3.1.txt b/tests/tests/imported/clang/c/C/C11/.n1285.rto/default.3.1.txt index 507b7493f8..e3a1d081aa 100644 --- a/tests/tests/imported/clang/c/C/C11/.n1285.rto/default.3.1.txt +++ b/tests/tests/imported/clang/c/C/C11/.n1285.rto/default.3.1.txt @@ -1,12 +1,4 @@ fe_only -DTEST_NUMBER=3 --clang -e 200 --no_wrap_diagnostics --clang_version 999999 --c++11 --c++ Test_name.c -"Test_name.c", line 44: warning: variable "p" was set but never used - int *p = (1 ? (struct X){ 0 } : f()).a; // expected-warning {{temporary whose address is used as value of local variable 'p' will be destroyed at the end of the full-expression}} - ^ - -"Test_name.c", line 45: warning: variable "r" was declared but never referenced - int *r = (1 ? (union U){ 0 } : g()).a; // expected-warning {{temporary whose address is used as value of local variable 'r' will be destroyed at the end of the full-expression}} - ^ - "Test_name.c", line 64: warning: variable "p" was set but never used int *p = ((void)0, x).a; // c-warning {{temporary whose address is used as value of local variable 'p' will be destroyed at the end of the full-expression}} ^ diff --git a/tests/tests/imported/clang/cpp/CXX/dcl.decl/dcl.init/dcl.init.general/.p16-cxx20.rto/default.1.1.txt b/tests/tests/imported/clang/cpp/CXX/dcl.decl/dcl.init/dcl.init.general/.p16-cxx20.rto/default.1.1.txt index b0262c2eb2..c3898711d9 100644 --- a/tests/tests/imported/clang/cpp/CXX/dcl.decl/dcl.init/dcl.init.general/.p16-cxx20.rto/default.1.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/dcl.decl/dcl.init/dcl.init.general/.p16-cxx20.rto/default.1.1.txt @@ -1,11 +1,4 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_version 999999 --c++20 Test_name.c -"Test_name.c", line 16: error: expression must have a constant value - static_assert(B().x == 0); - ^ -"Test_name.c", line 16: note: access to uninitialized object - static_assert(B().x == 0); - ^ - "Test_name.c", line 27: error: class "P0960R3::A" has no suitable copy constructor A a1(va); ^ @@ -144,4 +137,4 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers D d8 = {vdd}; // expected-error {{no matching constructor for initialization of 'D'}} ^ -31 errors detected in the compilation of "Test_name.c". +30 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.2.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.2.1.txt index d5201ea9f7..9548a3f4ef 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.2.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.2.1.txt @@ -43,18 +43,6 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -646,4 +634,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -110 errors detected in the compilation of "Test_name.c". +107 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.3.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.3.1.txt index 23c8ab2e65..9db8cdbba4 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.3.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.3.1.txt @@ -43,18 +43,6 @@ fe_only -DTEST_NUMBER=3 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -635,4 +623,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -107 errors detected in the compilation of "Test_name.c". +104 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.4.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.4.1.txt index 1738068cba..9d2c6600d9 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.4.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.4.1.txt @@ -43,18 +43,6 @@ fe_only -DTEST_NUMBER=4 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -628,4 +616,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -107 errors detected in the compilation of "Test_name.c". +104 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.5.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.5.1.txt index 2311036199..86fe3e2a79 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.5.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.5.1.txt @@ -43,18 +43,6 @@ fe_only -DTEST_NUMBER=5 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -612,4 +600,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -103 errors detected in the compilation of "Test_name.c". +100 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.6.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.6.1.txt index 1781ea59f2..d6dd6d1ccd 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.6.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.6.1.txt @@ -43,18 +43,6 @@ fe_only -DTEST_NUMBER=6 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -600,4 +588,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -100 errors detected in the compilation of "Test_name.c". +97 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.7.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.7.1.txt index 0f65ec7845..d00f917a4b 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.7.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/default.7.1.txt @@ -43,18 +43,6 @@ fe_only -DTEST_NUMBER=7 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -600,4 +588,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -100 errors detected in the compilation of "Test_name.c". +97 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.2.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.2.1.txt index e22c0c31f8..c3236cafd5 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.2.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.2.1.txt @@ -47,18 +47,6 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -650,4 +638,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -110 errors detected in the compilation of "Test_name.c". +107 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.3.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.3.1.txt index dd07f0d241..0237b2b78c 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.3.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.3.1.txt @@ -47,18 +47,6 @@ fe_only -DTEST_NUMBER=3 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -639,4 +627,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -107 errors detected in the compilation of "Test_name.c". +104 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.4.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.4.1.txt index b69b1360c8..299ea9b490 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.4.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.4.1.txt @@ -47,18 +47,6 @@ fe_only -DTEST_NUMBER=4 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -632,4 +620,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -107 errors detected in the compilation of "Test_name.c". +104 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.5.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.5.1.txt index b217fad05c..ba06bd79e4 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.5.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.5.1.txt @@ -47,18 +47,6 @@ fe_only -DTEST_NUMBER=5 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -616,4 +604,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -103 errors detected in the compilation of "Test_name.c". +100 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.6.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.6.1.txt index 99646fb4ff..81340c010d 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.6.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.6.1.txt @@ -47,18 +47,6 @@ fe_only -DTEST_NUMBER=6 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -604,4 +592,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -100 errors detected in the compilation of "Test_name.c". +97 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.7.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.7.1.txt index b8e9100361..b990a2e817 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.7.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32.7.1.txt @@ -47,18 +47,6 @@ fe_only -DTEST_NUMBER=7 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -604,4 +592,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -100 errors detected in the compilation of "Test_name.c". +97 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.2.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.2.1.txt index cce8c8aa1b..62a713b58b 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.2.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.2.1.txt @@ -47,18 +47,6 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -662,4 +650,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -113 errors detected in the compilation of "Test_name.c". +110 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.3.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.3.1.txt index d0dcb23e1c..e5e25bd263 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.3.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.3.1.txt @@ -47,18 +47,6 @@ fe_only -DTEST_NUMBER=3 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -651,4 +639,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -110 errors detected in the compilation of "Test_name.c". +107 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.4.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.4.1.txt index 5fe2dded14..05fb67f79d 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.4.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.4.1.txt @@ -47,18 +47,6 @@ fe_only -DTEST_NUMBER=4 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -644,4 +632,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -110 errors detected in the compilation of "Test_name.c". +107 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.5.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.5.1.txt index 1713a4fe68..8c3b9e6f7e 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.5.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.5.1.txt @@ -47,18 +47,6 @@ fe_only -DTEST_NUMBER=5 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -620,4 +608,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -104 errors detected in the compilation of "Test_name.c". +101 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.6.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.6.1.txt index b5fddc6c90..181f32677d 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.6.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.6.1.txt @@ -47,18 +47,6 @@ fe_only -DTEST_NUMBER=6 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -608,4 +596,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -101 errors detected in the compilation of "Test_name.c". +98 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.7.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.7.1.txt index d639969d32..c677f6521e 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.7.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_32_cp.7.1.txt @@ -47,18 +47,6 @@ fe_only -DTEST_NUMBER=7 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -608,4 +596,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -101 errors detected in the compilation of "Test_name.c". +98 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.2.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.2.1.txt index 0052781c05..763e1ae0cd 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.2.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.2.1.txt @@ -43,18 +43,6 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -658,4 +646,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -113 errors detected in the compilation of "Test_name.c". +110 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.3.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.3.1.txt index ceda8113e7..78fad00fa7 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.3.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.3.1.txt @@ -43,18 +43,6 @@ fe_only -DTEST_NUMBER=3 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -647,4 +635,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -110 errors detected in the compilation of "Test_name.c". +107 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.4.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.4.1.txt index e17ca6ed9b..afdfeedeb0 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.4.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.4.1.txt @@ -43,18 +43,6 @@ fe_only -DTEST_NUMBER=4 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -640,4 +628,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -110 errors detected in the compilation of "Test_name.c". +107 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.5.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.5.1.txt index fa617603ee..620594a888 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.5.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.5.1.txt @@ -43,18 +43,6 @@ fe_only -DTEST_NUMBER=5 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -616,4 +604,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -104 errors detected in the compilation of "Test_name.c". +101 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.6.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.6.1.txt index 7376d54ce6..b1f83c40fc 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.6.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.6.1.txt @@ -43,18 +43,6 @@ fe_only -DTEST_NUMBER=6 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -604,4 +592,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -101 errors detected in the compilation of "Test_name.c". +98 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.7.1.txt b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.7.1.txt index c247b4210d..4b40e10f9f 100644 --- a/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.7.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/drs/.cwg6xx.rto/edg_x86_64_cp.7.1.txt @@ -43,18 +43,6 @@ fe_only -DTEST_NUMBER=7 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers const std::type_info &an2 = typeid(n + 1); ^ -"Test_name.c", line 213: error: invalid redeclaration of type name "cwg616::T" (declared at line 212) - using T = decltype((static_cast(s).n)); - ^ - -"Test_name.c", line 214: error: invalid redeclaration of type name "cwg616::T" (declared at line 213) - using T = decltype((f().n)); - ^ - -"Test_name.c", line 215: error: invalid redeclaration of type name "cwg616::T" (declared at line 214) - using T = decltype(S().*&S::n); - ^ - "Test_name.c", line 246: error: incomplete type "int []" is not allowed sizeof(x); ^ @@ -604,4 +592,4 @@ At end of source: error: expected a "}" constexpr int c = true || f(); ^ -101 errors detected in the compilation of "Test_name.c". +98 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/default.1.1.txt b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/default.1.1.txt index 41aa144829..70d6b18565 100644 --- a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/default.1.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/default.1.1.txt @@ -378,6 +378,13 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers static_assert(vrs.i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} ^ +"Test_name.c", line 362: error: expression must have a constant value + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ +"Test_name.c", line 362: note: attempt to read from volatile storage + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ + "Test_name.c", line 363: error: expression must have a constant value static_assert(((volatile const S&&)(S)0).i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} ^ @@ -1102,4 +1109,4 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr bool v8 = qv > (void*)&s.a; ^ -93 errors detected in the compilation of "Test_name.c". +94 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/default.2.1.txt b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/default.2.1.txt index ad76d16536..8665cb9052 100644 --- a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/default.2.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/default.2.1.txt @@ -365,6 +365,13 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr volatile S f() { return S(); } // cxx20-warning {{volatile-qualified return type 'volatile S' is deprecated}} ^ +"Test_name.c", line 362: error: expression must have a constant value + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ +"Test_name.c", line 362: note: attempt to read from volatile storage + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ + "Test_name.c", line 363: error: expression must have a constant value static_assert(((volatile const S&&)(S)0).i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} ^ @@ -1140,4 +1147,4 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr bool v8 = qv > (void*)&s.a; ^ -93 errors detected in the compilation of "Test_name.c". +94 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32.1.1.txt b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32.1.1.txt index 3a105690d4..909746dbc3 100644 --- a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32.1.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32.1.1.txt @@ -391,6 +391,13 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers static_assert(vrs.i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} ^ +"Test_name.c", line 362: error: expression must have a constant value + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ +"Test_name.c", line 362: note: attempt to read from volatile storage + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ + "Test_name.c", line 363: error: expression must have a constant value static_assert(((volatile const S&&)(S)0).i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} ^ @@ -1122,4 +1129,4 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr intptr_t i = f((intptr_t)&foo - 10); // expected-error{{constexpr variable 'i' must be initialized by a constant expression}} \ ^ -96 errors detected in the compilation of "Test_name.c". +97 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32.2.1.txt b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32.2.1.txt index ad790e2063..b880afe7f7 100644 --- a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32.2.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32.2.1.txt @@ -374,6 +374,13 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr volatile S f() { return S(); } // cxx20-warning {{volatile-qualified return type 'volatile S' is deprecated}} ^ +"Test_name.c", line 362: error: expression must have a constant value + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ +"Test_name.c", line 362: note: attempt to read from volatile storage + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ + "Test_name.c", line 363: error: expression must have a constant value static_assert(((volatile const S&&)(S)0).i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} ^ @@ -1156,4 +1163,4 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr intptr_t i = f((intptr_t)&foo - 10); // expected-error{{constexpr variable 'i' must be initialized by a constant expression}} \ ^ -95 errors detected in the compilation of "Test_name.c". +96 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32_cp.1.1.txt b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32_cp.1.1.txt index 2d9a69a61b..625c42ed90 100644 --- a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32_cp.1.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32_cp.1.1.txt @@ -379,6 +379,13 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers static_assert(vrs.i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} ^ +"Test_name.c", line 362: error: expression must have a constant value + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ +"Test_name.c", line 362: note: attempt to read from volatile storage + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ + "Test_name.c", line 363: error: expression must have a constant value static_assert(((volatile const S&&)(S)0).i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} ^ @@ -1110,4 +1117,4 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr intptr_t i = f((intptr_t)&foo - 10); // expected-error{{constexpr variable 'i' must be initialized by a constant expression}} \ ^ -96 errors detected in the compilation of "Test_name.c". +97 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32_cp.2.1.txt b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32_cp.2.1.txt index 41df730ffc..6cc6c6b4c2 100644 --- a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32_cp.2.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_32_cp.2.1.txt @@ -362,6 +362,13 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr volatile S f() { return S(); } // cxx20-warning {{volatile-qualified return type 'volatile S' is deprecated}} ^ +"Test_name.c", line 362: error: expression must have a constant value + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ +"Test_name.c", line 362: note: attempt to read from volatile storage + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ + "Test_name.c", line 363: error: expression must have a constant value static_assert(((volatile const S&&)(S)0).i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} ^ @@ -1144,4 +1151,4 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr intptr_t i = f((intptr_t)&foo - 10); // expected-error{{constexpr variable 'i' must be initialized by a constant expression}} \ ^ -95 errors detected in the compilation of "Test_name.c". +96 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_64_cp.1.1.txt b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_64_cp.1.1.txt index e7c5f5736d..47a500eef9 100644 --- a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_64_cp.1.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_64_cp.1.1.txt @@ -366,6 +366,13 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers static_assert(vrs.i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} ^ +"Test_name.c", line 362: error: expression must have a constant value + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ +"Test_name.c", line 362: note: attempt to read from volatile storage + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ + "Test_name.c", line 363: error: expression must have a constant value static_assert(((volatile const S&&)(S)0).i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} ^ @@ -1090,4 +1097,4 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr bool v8 = qv > (void*)&s.a; ^ -93 errors detected in the compilation of "Test_name.c". +94 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_64_cp.2.1.txt b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_64_cp.2.1.txt index 57fddb4333..c74f13ebbb 100644 --- a/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_64_cp.2.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/expr/expr.const/.p2-0x.rto/edg_x86_64_cp.2.1.txt @@ -353,6 +353,13 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr volatile S f() { return S(); } // cxx20-warning {{volatile-qualified return type 'volatile S' is deprecated}} ^ +"Test_name.c", line 362: error: expression must have a constant value + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ +"Test_name.c", line 362: note: attempt to read from volatile storage + static_assert(f().i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} + ^ + "Test_name.c", line 363: error: expression must have a constant value static_assert(((volatile const S&&)(S)0).i, ""); // expected-error {{constant expression}} expected-note {{read of volatile-qualified type}} ^ @@ -1128,4 +1135,4 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr bool v8 = qv > (void*)&s.a; ^ -93 errors detected in the compilation of "Test_name.c". +94 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/special/class.init/class.inhctor.init/.p1.rto/default.1.1.txt b/tests/tests/imported/clang/cpp/CXX/special/class.init/class.inhctor.init/.p1.rto/default.1.1.txt index b861f68325..bad18c1ab6 100644 --- a/tests/tests/imported/clang/cpp/CXX/special/class.init/class.inhctor.init/.p1.rto/default.1.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/special/class.init/class.inhctor.init/.p1.rto/default.1.1.txt @@ -38,17 +38,4 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers ^ detected during implicit generation of "vbase::D::B(int, int)" at line 89 -"Test_name.c", line 125: error: expression must have a constant value - constexpr Wrap2 b = {}; - ^ -"Test_name.c", line 117: note: access to uninitialized object - constexpr Param(int c) : n(4 * b.a + b.b + c) {} - ^ -"Test_name.c", line 123: note: called from: - constexpr Wrap1::Wrap1() : B(1) {} - ^ -"Test_name.c", line 112: note: called from: - struct Wrap2 : Wrap1 {}; - ^ - -10 errors detected in the compilation of "Test_name.c". +9 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/default.1.1.txt b/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/default.1.1.txt index 16c6279d34..c68a2f80db 100644 --- a/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/default.1.1.txt +++ b/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/default.1.1.txt @@ -226,14 +226,14 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers ^ "SemaCXX/constant-expression-cxx2a.cpp", line 586: note: access to uninitialized object static_assert(Y(0,0).z1.n == 0); - ^ + ^ "SemaCXX/constant-expression-cxx2a.cpp", line 587: error: expression must have a constant value static_assert(Y(0,0).z3.n == 0); ^ "SemaCXX/constant-expression-cxx2a.cpp", line 587: note: access to uninitialized object static_assert(Y(0,0).z3.n == 0); - ^ + ^ "SemaCXX/constant-expression-cxx2a.cpp", line 589: error: expression must have a constant value static_assert(copy(Y(0,0)).z2.n == 0); diff --git a/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/edg_x86_32.1.1.txt b/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/edg_x86_32.1.1.txt index 16c6279d34..c68a2f80db 100644 --- a/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/edg_x86_32.1.1.txt +++ b/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/edg_x86_32.1.1.txt @@ -226,14 +226,14 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers ^ "SemaCXX/constant-expression-cxx2a.cpp", line 586: note: access to uninitialized object static_assert(Y(0,0).z1.n == 0); - ^ + ^ "SemaCXX/constant-expression-cxx2a.cpp", line 587: error: expression must have a constant value static_assert(Y(0,0).z3.n == 0); ^ "SemaCXX/constant-expression-cxx2a.cpp", line 587: note: access to uninitialized object static_assert(Y(0,0).z3.n == 0); - ^ + ^ "SemaCXX/constant-expression-cxx2a.cpp", line 589: error: expression must have a constant value static_assert(copy(Y(0,0)).z2.n == 0); diff --git a/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/edg_x86_32_cp.1.1.txt b/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/edg_x86_32_cp.1.1.txt index d0fe502c96..335c58d2ba 100644 --- a/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/edg_x86_32_cp.1.1.txt +++ b/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/edg_x86_32_cp.1.1.txt @@ -233,14 +233,14 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers ^ "SemaCXX/constant-expression-cxx2a.cpp", line 586: note: access to uninitialized object static_assert(Y(0,0).z1.n == 0); - ^ + ^ "SemaCXX/constant-expression-cxx2a.cpp", line 587: error: expression must have a constant value static_assert(Y(0,0).z3.n == 0); ^ "SemaCXX/constant-expression-cxx2a.cpp", line 587: note: access to uninitialized object static_assert(Y(0,0).z3.n == 0); - ^ + ^ "SemaCXX/constant-expression-cxx2a.cpp", line 589: error: expression must have a constant value static_assert(copy(Y(0,0)).z2.n == 0); diff --git a/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/edg_x86_64_cp.1.1.txt b/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/edg_x86_64_cp.1.1.txt index d0fe502c96..335c58d2ba 100644 --- a/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/edg_x86_64_cp.1.1.txt +++ b/tests/tests/imported/clang/cpp/SemaCXX/.constant-expression-cxx2a.rto/edg_x86_64_cp.1.1.txt @@ -233,14 +233,14 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers ^ "SemaCXX/constant-expression-cxx2a.cpp", line 586: note: access to uninitialized object static_assert(Y(0,0).z1.n == 0); - ^ + ^ "SemaCXX/constant-expression-cxx2a.cpp", line 587: error: expression must have a constant value static_assert(Y(0,0).z3.n == 0); ^ "SemaCXX/constant-expression-cxx2a.cpp", line 587: note: access to uninitialized object static_assert(Y(0,0).z3.n == 0); - ^ + ^ "SemaCXX/constant-expression-cxx2a.cpp", line 589: error: expression must have a constant value static_assert(copy(Y(0,0)).z2.n == 0); diff --git a/tests/tests/imported/clang/cpp/SemaCXX/.constexpr-value-init.rto/default.1.1.txt b/tests/tests/imported/clang/cpp/SemaCXX/.constexpr-value-init.rto/default.1.1.txt index dbe90c1c66..060b495068 100644 --- a/tests/tests/imported/clang/cpp/SemaCXX/.constexpr-value-init.rto/default.1.1.txt +++ b/tests/tests/imported/clang/cpp/SemaCXX/.constexpr-value-init.rto/default.1.1.txt @@ -30,16 +30,6 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers struct B { // expected-note {{in call to 'A()'}} ^ -"Test_name.c", line 22: error: expression must have a constant value - constexpr B b2 = B(); // ok - ^ -"Test_name.c", line 7: note: access to uninitialized object - constexpr A() : a(b + 1), b(a + 1) {} // expected-note 5{{outside its lifetime}} - ^ -"Test_name.c", line 11: note: called from: - struct B { // expected-note {{in call to 'A()'}} - ^ - "Test_name.c", line 30: error: const variable "c1" requires an initializer -- class "C" has no user-provided default constructor constexpr C c1; // expected-error {{without a user-provided default constructor}} ^ @@ -67,16 +57,6 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr E e1; // expected-error {{constant expression}} expected-note {{in call to 'E()'}} ^ -"Test_name.c", line 47: error: expression must have a constant value - constexpr E e2 = E(); - ^ -"Test_name.c", line 7: note: access to uninitialized object - constexpr A() : a(b + 1), b(a + 1) {} // expected-note 5{{outside its lifetime}} - ^ -"Test_name.c", line 46: note: called from: - constexpr E e1; // expected-error {{constant expression}} expected-note {{in call to 'E()'}} - ^ - "Test_name.c", line 59: error: incomplete type "InvalidDeclInsideConstExpr::i<1>" is not allowed i g; // expected-error {{implicit instantiation of undefined template 'InvalidDeclInsideConstExpr::i<1>'}} ^ @@ -118,4 +98,4 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr E e1; // expected-error {{constant expression}} expected-note {{in call to 'E()'}} ^ -12 errors detected in the compilation of "Test_name.c". +10 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/SemaCXX/.constexpr-value-init.rto/default.2.1.txt b/tests/tests/imported/clang/cpp/SemaCXX/.constexpr-value-init.rto/default.2.1.txt index 413803bd7f..20da054180 100644 --- a/tests/tests/imported/clang/cpp/SemaCXX/.constexpr-value-init.rto/default.2.1.txt +++ b/tests/tests/imported/clang/cpp/SemaCXX/.constexpr-value-init.rto/default.2.1.txt @@ -30,16 +30,6 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers struct B { // expected-note {{in call to 'A()'}} ^ -"Test_name.c", line 22: error: expression must have a constant value - constexpr B b2 = B(); // ok - ^ -"Test_name.c", line 7: note: access to uninitialized object - constexpr A() : a(b + 1), b(a + 1) {} // expected-note 5{{outside its lifetime}} - ^ -"Test_name.c", line 11: note: called from: - struct B { // expected-note {{in call to 'A()'}} - ^ - "Test_name.c", line 30: error: const variable "c1" requires an initializer -- class "C" has no user-provided default constructor constexpr C c1; // expected-error {{without a user-provided default constructor}} ^ @@ -67,16 +57,6 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr E e1; // expected-error {{constant expression}} expected-note {{in call to 'E()'}} ^ -"Test_name.c", line 47: error: expression must have a constant value - constexpr E e2 = E(); - ^ -"Test_name.c", line 7: note: access to uninitialized object - constexpr A() : a(b + 1), b(a + 1) {} // expected-note 5{{outside its lifetime}} - ^ -"Test_name.c", line 46: note: called from: - constexpr E e1; // expected-error {{constant expression}} expected-note {{in call to 'E()'}} - ^ - "Test_name.c", line 59: error: incomplete type "InvalidDeclInsideConstExpr::i<1>" is not allowed i g; // expected-error {{implicit instantiation of undefined template 'InvalidDeclInsideConstExpr::i<1>'}} ^ @@ -118,4 +98,4 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers constexpr E e1; // expected-error {{constant expression}} expected-note {{in call to 'E()'}} ^ -12 errors detected in the compilation of "Test_name.c". +10 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/SemaCXX/.cxx2c-placeholder-vars.rto/default.1.1.txt b/tests/tests/imported/clang/cpp/SemaCXX/.cxx2c-placeholder-vars.rto/default.1.1.txt index 277238cca3..67ead7a95a 100644 --- a/tests/tests/imported/clang/cpp/SemaCXX/.cxx2c-placeholder-vars.rto/default.1.1.txt +++ b/tests/tests/imported/clang/cpp/SemaCXX/.cxx2c-placeholder-vars.rto/default.1.1.txt @@ -267,10 +267,6 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers int _, _; // expected-warning {{placeholder variables are incompatible with C++ standards before C++2c}} \ ^ -"Test_name.c", line 236: warning: expression has no effect - S{}._; // expected-error {{ambiguous reference to placeholder '_', which is defined multiple times}} - ^ - "Test_name.c", line 235: warning: variable "s" was declared but never referenced S s{._ =0}; // expected-error {{ambiguous reference to placeholder '_', which is defined multiple times}} ^ diff --git a/tests/tests/imported/gnu/cpp/cpp0x/.constexpr-delegating3.rto/default.1.1.txt b/tests/tests/imported/gnu/cpp/cpp0x/.constexpr-delegating3.rto/default.1.1.txt index fe3eb50e9e..1026717d8f 100644 --- a/tests/tests/imported/gnu/cpp/cpp0x/.constexpr-delegating3.rto/default.1.1.txt +++ b/tests/tests/imported/gnu/cpp/cpp0x/.constexpr-delegating3.rto/default.1.1.txt @@ -1,9 +1,9 @@ fe_only -DTEST_NUMBER=1 --gnu_version=999999 -tused -e 200 --no_wrap --no_wrap_diagnostics --c++11 Test_name.c -"Test_name.c", line 12: error: static assertion failed with "" +"Test_name.c", line 12: error: expression must have a constant value static_assert(test(0).m == 0, ""); - ^ -"Test_name.c", line 12: note: the final comparison was -48039863565308959547770532813896688677 == 0 + ^ +"Test_name.c", line 12: note: access to uninitialized object static_assert(test(0).m == 0, ""); - ^ + ^ 1 error detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/gnu/cpp/cpp0x/.constexpr-delegating3.rto/edg_x86_32.1.1.txt b/tests/tests/imported/gnu/cpp/cpp0x/.constexpr-delegating3.rto/edg_x86_32.1.1.txt deleted file mode 100644 index 439ecda17a..0000000000 --- a/tests/tests/imported/gnu/cpp/cpp0x/.constexpr-delegating3.rto/edg_x86_32.1.1.txt +++ /dev/null @@ -1,9 +0,0 @@ -fe_only -DTEST_NUMBER=1 --gnu_version=999999 -tused -e 200 --no_wrap --no_wrap_diagnostics --c++11 Test_name.c -"Test_name.c", line 12: error: static assertion failed with "" - static_assert(test(0).m == 0, ""); - ^ -"Test_name.c", line 12: note: the final comparison was -2604246222170760229 == 0 - static_assert(test(0).m == 0, ""); - ^ - -1 error detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/gnu/cpp/cpp0x/.constexpr-delegating3.rto/edg_x86_32_cp.1.1.txt b/tests/tests/imported/gnu/cpp/cpp0x/.constexpr-delegating3.rto/edg_x86_32_cp.1.1.txt deleted file mode 100644 index 439ecda17a..0000000000 --- a/tests/tests/imported/gnu/cpp/cpp0x/.constexpr-delegating3.rto/edg_x86_32_cp.1.1.txt +++ /dev/null @@ -1,9 +0,0 @@ -fe_only -DTEST_NUMBER=1 --gnu_version=999999 -tused -e 200 --no_wrap --no_wrap_diagnostics --c++11 Test_name.c -"Test_name.c", line 12: error: static assertion failed with "" - static_assert(test(0).m == 0, ""); - ^ -"Test_name.c", line 12: note: the final comparison was -2604246222170760229 == 0 - static_assert(test(0).m == 0, ""); - ^ - -1 error detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/gnu/cpp/cpp0x/.decltype72.rto/default.1.1.txt b/tests/tests/imported/gnu/cpp/cpp0x/.decltype72.rto/default.1.1.txt index e08c7c958e..dcdf4c999a 100644 --- a/tests/tests/imported/gnu/cpp/cpp0x/.decltype72.rto/default.1.1.txt +++ b/tests/tests/imported/gnu/cpp/cpp0x/.decltype72.rto/default.1.1.txt @@ -1,6 +1 @@ fe_only -DTEST_NUMBER=1 --gnu_version=999999 -tused -e 200 --no_wrap --no_wrap_diagnostics --c++11 Test_name.c -"Test_name.c", line 21: error: static assertion failed with "" - static_assert(is_same::value, ""); - ^ - -1 error detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/gnu/cpp/cpp26/.name-independent-decl6.rto/default.1.1.txt b/tests/tests/imported/gnu/cpp/cpp26/.name-independent-decl6.rto/default.1.1.txt index 5bb8480f29..e2dfda6f01 100644 --- a/tests/tests/imported/gnu/cpp/cpp26/.name-independent-decl6.rto/default.1.1.txt +++ b/tests/tests/imported/gnu/cpp/cpp26/.name-independent-decl6.rto/default.1.1.txt @@ -59,10 +59,6 @@ fe_only -DTEST_NUMBER=1 --gnu_version=999999 -tused -e 200 --no_wrap --no_wrap_d int _; // { dg-warning "name-independent declarations only available with" "" { target c++23_down } } ^ -"Test_name.c", line 91: warning: expression has no effect - D {}._; // { dg-error "request for member '_' is ambiguous" } - ^ - "Test_name.c", line 98: error: "_" has already been declared in the current scope int _; // { dg-warning "name-independent declarations only available with" "" { target c++23_down } } ^ diff --git a/tests/tests/imported/gnu/cpp/cpp2a/.constexpr-init18.rto/default.1.1.txt b/tests/tests/imported/gnu/cpp/cpp2a/.constexpr-init18.rto/default.1.1.txt index 73ead29a37..2ed4eaf390 100644 --- a/tests/tests/imported/gnu/cpp/cpp2a/.constexpr-init18.rto/default.1.1.txt +++ b/tests/tests/imported/gnu/cpp/cpp2a/.constexpr-init18.rto/default.1.1.txt @@ -1,16 +1 @@ fe_only -DTEST_NUMBER=1 --gnu_version=999999 -tused -e 200 --no_wrap --no_wrap_diagnostics --c++20 Test_name.c -"Test_name.c", line 14: error: initialization is not constant - constexpr t<1> h1; - ^ -"Test_name.c", line 14: note: access to uninitialized subobject (member "e::w") - constexpr t<1> h1; - ^ - -"Test_name.c", line 17: error: initialization is not constant - constexpr t<42> h2; - ^ -"Test_name.c", line 17: note: access to uninitialized subobject (member "e::w") - constexpr t<42> h2; - ^ - -2 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/regressions/.gh-90-old-modes.rto/default.1.1.txt b/tests/tests/regressions/.gh-90-old-modes.rto/default.1.1.txt new file mode 100644 index 0000000000..38d19b508a --- /dev/null +++ b/tests/tests/regressions/.gh-90-old-modes.rto/default.1.1.txt @@ -0,0 +1 @@ +fe_only -DTEST_NUMBER=1 --c++14 --g++ --gnu_version=80300 Test_name.c diff --git a/tests/tests/regressions/.gh-90-old-modes.rto/default.2.1.txt b/tests/tests/regressions/.gh-90-old-modes.rto/default.2.1.txt new file mode 100644 index 0000000000..fdbcccb1e7 --- /dev/null +++ b/tests/tests/regressions/.gh-90-old-modes.rto/default.2.1.txt @@ -0,0 +1 @@ +fe_only -DTEST_NUMBER=2 --c++14 --clang --clang_version=30900 Test_name.c diff --git a/tests/tests/regressions/.gh-90-uninit-member.rto/default.1.1.txt b/tests/tests/regressions/.gh-90-uninit-member.rto/default.1.1.txt new file mode 100644 index 0000000000..2534a07369 --- /dev/null +++ b/tests/tests/regressions/.gh-90-uninit-member.rto/default.1.1.txt @@ -0,0 +1,16 @@ +fe_only -DTEST_NUMBER=1 --c++20 Test_name.c +"Test_name.c", line 16: error: expression must have a constant value + static_assert(W().n == 0); // Error. + ^ +"Test_name.c", line 16: note: access to uninitialized object + static_assert(W().n == 0); // Error. + ^ + +"Test_name.c", line 17: error: expression must have a constant value + static_assert((W().*pn) == 0); // Error. + ^ +"Test_name.c", line 17: note: access to uninitialized object + static_assert((W().*pn) == 0); // Error. + ^ + +2 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/regressions/.gh-90-uninit-member.rto/default.2.1.txt b/tests/tests/regressions/.gh-90-uninit-member.rto/default.2.1.txt new file mode 100644 index 0000000000..5038d93afe --- /dev/null +++ b/tests/tests/regressions/.gh-90-uninit-member.rto/default.2.1.txt @@ -0,0 +1,16 @@ +fe_only -DTEST_NUMBER=2 --c++20 --g++ --gnu_version=150000 Test_name.c +"Test_name.c", line 16: error: expression must have a constant value + static_assert(W().n == 0); // Error. + ^ +"Test_name.c", line 16: note: access to uninitialized object + static_assert(W().n == 0); // Error. + ^ + +"Test_name.c", line 17: error: expression must have a constant value + static_assert((W().*pn) == 0); // Error. + ^ +"Test_name.c", line 17: note: access to uninitialized object + static_assert((W().*pn) == 0); // Error. + ^ + +2 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/regressions/.gh-90-uninit-member.rto/default.3.1.txt b/tests/tests/regressions/.gh-90-uninit-member.rto/default.3.1.txt new file mode 100644 index 0000000000..9d0d530517 --- /dev/null +++ b/tests/tests/regressions/.gh-90-uninit-member.rto/default.3.1.txt @@ -0,0 +1,16 @@ +fe_only -DTEST_NUMBER=3 --c++20 --clang --clang_version=190100 Test_name.c +"Test_name.c", line 16: error: expression must have a constant value + static_assert(W().n == 0); // Error. + ^ +"Test_name.c", line 16: note: access to uninitialized object + static_assert(W().n == 0); // Error. + ^ + +"Test_name.c", line 17: error: expression must have a constant value + static_assert((W().*pn) == 0); // Error. + ^ +"Test_name.c", line 17: note: access to uninitialized object + static_assert((W().*pn) == 0); // Error. + ^ + +2 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/regressions/.gh-90-vector-diag.rto/default.1.1.txt b/tests/tests/regressions/.gh-90-vector-diag.rto/default.1.1.txt new file mode 100644 index 0000000000..6124763942 --- /dev/null +++ b/tests/tests/regressions/.gh-90-vector-diag.rto/default.1.1.txt @@ -0,0 +1,40 @@ +fe_only -DTEST_NUMBER=1 --c++20 --g++ --gnu_version=150200 Test_name.c +"Test_name.c", line 13: error: expression must have a constant value + static_assert(e1() == 0); // Error. + ^ +"Test_name.c", line 12: note: access to uninitialized object + constexpr int e1() { X x; x.v[0] = 1; return x.v[2]; } + ^ + +"Test_name.c", line 16: error: expression must have a constant value + static_assert(e2() == 0); // Error. + ^ +"Test_name.c", line 10: note: access to uninitialized object + struct Z { v4 v; constexpr Z(const v4 &a) : v(a) {} }; + ^ +"Test_name.c", line 15: note: called from: + constexpr int e2() { X x; x.v[0] = 1; Z z(x.v); return z.v[3]; } + ^ + +"Test_name.c", line 19: error: expression must have a constant value + static_assert(e3() == 0); // Error. + ^ +"Test_name.c", line 18: note: access to uninitialized object + constexpr int e3() { X x; x.v[0] = 1; X y; y.v = x.v; return y.v[3]; } + ^ + +"Test_name.c", line 22: error: expression must have a constant value + static_assert(e4() == 1); // Error. + ^ +"Test_name.c", line 21: note: access to uninitialized object + constexpr int e4() { X x; x.v[1] = 1; X y = x; return y.v[1]; } + ^ + +"Test_name.c", line 25: error: expression must have a constant value + static_assert(e5() == 1); // Error. + ^ +"Test_name.c", line 24: note: access to uninitialized object + constexpr int e5() { X x; x.v[0] = 1; X y = x; return y.v[0]; } + ^ + +5 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/regressions/.gh-90-vector-diag.rto/default.2.1.txt b/tests/tests/regressions/.gh-90-vector-diag.rto/default.2.1.txt new file mode 100644 index 0000000000..910f03f414 --- /dev/null +++ b/tests/tests/regressions/.gh-90-vector-diag.rto/default.2.1.txt @@ -0,0 +1,40 @@ +fe_only -DTEST_NUMBER=2 --c++20 --clang --clang_version=190100 Test_name.c +"Test_name.c", line 13: error: expression must have a constant value + static_assert(e1() == 0); // Error. + ^ +"Test_name.c", line 12: note: access to uninitialized object + constexpr int e1() { X x; x.v[0] = 1; return x.v[2]; } + ^ + +"Test_name.c", line 16: error: expression must have a constant value + static_assert(e2() == 0); // Error. + ^ +"Test_name.c", line 10: note: access to uninitialized object + struct Z { v4 v; constexpr Z(const v4 &a) : v(a) {} }; + ^ +"Test_name.c", line 15: note: called from: + constexpr int e2() { X x; x.v[0] = 1; Z z(x.v); return z.v[3]; } + ^ + +"Test_name.c", line 19: error: expression must have a constant value + static_assert(e3() == 0); // Error. + ^ +"Test_name.c", line 18: note: access to uninitialized object + constexpr int e3() { X x; x.v[0] = 1; X y; y.v = x.v; return y.v[3]; } + ^ + +"Test_name.c", line 22: error: expression must have a constant value + static_assert(e4() == 1); // Error. + ^ +"Test_name.c", line 21: note: access to uninitialized object + constexpr int e4() { X x; x.v[1] = 1; X y = x; return y.v[1]; } + ^ + +"Test_name.c", line 25: error: expression must have a constant value + static_assert(e5() == 1); // Error. + ^ +"Test_name.c", line 24: note: access to uninitialized object + constexpr int e5() { X x; x.v[0] = 1; X y = x; return y.v[0]; } + ^ + +5 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/regressions/.gh-90-vector.rto/default.1.1.txt b/tests/tests/regressions/.gh-90-vector.rto/default.1.1.txt new file mode 100644 index 0000000000..566baa0764 --- /dev/null +++ b/tests/tests/regressions/.gh-90-vector.rto/default.1.1.txt @@ -0,0 +1 @@ +fe_only -DTEST_NUMBER=1 --c++20 --g++ --gnu_version=150200 Test_name.c diff --git a/tests/tests/regressions/.gh-90-vector.rto/default.2.1.txt b/tests/tests/regressions/.gh-90-vector.rto/default.2.1.txt new file mode 100644 index 0000000000..e2b53c8273 --- /dev/null +++ b/tests/tests/regressions/.gh-90-vector.rto/default.2.1.txt @@ -0,0 +1 @@ +fe_only -DTEST_NUMBER=2 --c++20 --clang --clang_version=190100 Test_name.c diff --git a/tests/tests/regressions/.gh-90-warn.rto/default.1.1.txt b/tests/tests/regressions/.gh-90-warn.rto/default.1.1.txt new file mode 100644 index 0000000000..951991467d --- /dev/null +++ b/tests/tests/regressions/.gh-90-warn.rto/default.1.1.txt @@ -0,0 +1,25 @@ +fe_only -DTEST_NUMBER=1 --c++20 Test_name.c +"Test_name.c", line 12: warning: returning reference to local temporary + const int &f1() { return A().b; } // Warning. + ^ + +"Test_name.c", line 13: warning: returning pointer to local temporary + const int *f2() { return &static_cast(A().b); } // Warning. + ^ + +"Test_name.c", line 14: warning: returning reference to local temporary + int &&f3() { return static_cast(A()).b; } // Warning. + ^ + +"Test_name.c", line 27: warning: returning pointer to local temporary + const int *f4() { return &static_cast(make().b); } // Warning. + ^ + +"Test_name.c", line 28: warning: returning pointer to local temporary + const int *f5() { return make().arr; } // Warning (not with GCC 8). + ^ + +"Test_name.c", line 29: warning: returning pointer to local temporary + const int *f6() { return &make().arr[1]; } // Warning (not with GCC 8). + ^ + diff --git a/tests/tests/regressions/.gh-90-warn.rto/default.2.1.txt b/tests/tests/regressions/.gh-90-warn.rto/default.2.1.txt new file mode 100644 index 0000000000..a82d0274cf --- /dev/null +++ b/tests/tests/regressions/.gh-90-warn.rto/default.2.1.txt @@ -0,0 +1,25 @@ +fe_only -DTEST_NUMBER=2 --c++20 --g++ --gnu_version=150000 Test_name.c +"Test_name.c", line 12: warning: returning reference to local temporary + const int &f1() { return A().b; } // Warning. + ^ + +"Test_name.c", line 13: warning: returning pointer to local temporary + const int *f2() { return &static_cast(A().b); } // Warning. + ^ + +"Test_name.c", line 14: warning: returning reference to local temporary + int &&f3() { return static_cast(A()).b; } // Warning. + ^ + +"Test_name.c", line 27: warning: returning pointer to local temporary + const int *f4() { return &static_cast(make().b); } // Warning. + ^ + +"Test_name.c", line 28: warning: returning pointer to local temporary + const int *f5() { return make().arr; } // Warning (not with GCC 8). + ^ + +"Test_name.c", line 29: warning: returning pointer to local temporary + const int *f6() { return &make().arr[1]; } // Warning (not with GCC 8). + ^ + diff --git a/tests/tests/regressions/.gh-90-warn.rto/default.3.1.txt b/tests/tests/regressions/.gh-90-warn.rto/default.3.1.txt new file mode 100644 index 0000000000..c38ee3e62d --- /dev/null +++ b/tests/tests/regressions/.gh-90-warn.rto/default.3.1.txt @@ -0,0 +1,17 @@ +fe_only -DTEST_NUMBER=3 --c++20 --g++ --gnu_version=80000 Test_name.c +"Test_name.c", line 12: warning: returning reference to local temporary + const int &f1() { return A().b; } // Warning. + ^ + +"Test_name.c", line 13: warning: returning pointer to local temporary + const int *f2() { return &static_cast(A().b); } // Warning. + ^ + +"Test_name.c", line 14: warning: returning reference to local temporary + int &&f3() { return static_cast(A()).b; } // Warning. + ^ + +"Test_name.c", line 27: warning: returning pointer to local temporary + const int *f4() { return &static_cast(make().b); } // Warning. + ^ + diff --git a/tests/tests/regressions/.gh-90-warn.rto/default.4.1.txt b/tests/tests/regressions/.gh-90-warn.rto/default.4.1.txt new file mode 100644 index 0000000000..5961dc36e6 --- /dev/null +++ b/tests/tests/regressions/.gh-90-warn.rto/default.4.1.txt @@ -0,0 +1,25 @@ +fe_only -DTEST_NUMBER=4 --c++20 --clang --clang_version=190100 Test_name.c +"Test_name.c", line 12: warning: returning reference to local temporary + const int &f1() { return A().b; } // Warning. + ^ + +"Test_name.c", line 13: warning: returning pointer to local temporary + const int *f2() { return &static_cast(A().b); } // Warning. + ^ + +"Test_name.c", line 14: warning: returning reference to local temporary + int &&f3() { return static_cast(A()).b; } // Warning. + ^ + +"Test_name.c", line 27: warning: returning pointer to local temporary + const int *f4() { return &static_cast(make().b); } // Warning. + ^ + +"Test_name.c", line 28: warning: returning pointer to local temporary + const int *f5() { return make().arr; } // Warning (not with GCC 8). + ^ + +"Test_name.c", line 29: warning: returning pointer to local temporary + const int *f6() { return &make().arr[1]; } // Warning (not with GCC 8). + ^ + diff --git a/tests/tests/regressions/.gh-90-warn.rto/default.5.1.txt b/tests/tests/regressions/.gh-90-warn.rto/default.5.1.txt new file mode 100644 index 0000000000..17cce8283d --- /dev/null +++ b/tests/tests/regressions/.gh-90-warn.rto/default.5.1.txt @@ -0,0 +1,25 @@ +fe_only -DTEST_NUMBER=5 --c++11 --g++ --gnu_version=150000 Test_name.c +"Test_name.c", line 12: warning: returning reference to local temporary + const int &f1() { return A().b; } // Warning. + ^ + +"Test_name.c", line 13: warning: returning pointer to local temporary + const int *f2() { return &static_cast(A().b); } // Warning. + ^ + +"Test_name.c", line 14: warning: returning reference to local temporary + int &&f3() { return static_cast(A()).b; } // Warning. + ^ + +"Test_name.c", line 27: warning: returning pointer to local temporary + const int *f4() { return &static_cast(make().b); } // Warning. + ^ + +"Test_name.c", line 28: warning: returning pointer to local temporary + const int *f5() { return make().arr; } // Warning (not with GCC 8). + ^ + +"Test_name.c", line 29: warning: returning pointer to local temporary + const int *f6() { return &make().arr[1]; } // Warning (not with GCC 8). + ^ + diff --git a/tests/tests/regressions/.gh-90-warn.rto/default.6.1.txt b/tests/tests/regressions/.gh-90-warn.rto/default.6.1.txt new file mode 100644 index 0000000000..ccf4288f55 --- /dev/null +++ b/tests/tests/regressions/.gh-90-warn.rto/default.6.1.txt @@ -0,0 +1,25 @@ +fe_only -DTEST_NUMBER=6 --c++11 --clang --clang_version=190100 Test_name.c +"Test_name.c", line 12: warning: returning reference to local temporary + const int &f1() { return A().b; } // Warning. + ^ + +"Test_name.c", line 13: warning: returning pointer to local temporary + const int *f2() { return &static_cast(A().b); } // Warning. + ^ + +"Test_name.c", line 14: warning: returning reference to local temporary + int &&f3() { return static_cast(A()).b; } // Warning. + ^ + +"Test_name.c", line 27: warning: returning pointer to local temporary + const int *f4() { return &static_cast(make().b); } // Warning. + ^ + +"Test_name.c", line 28: warning: returning pointer to local temporary + const int *f5() { return make().arr; } // Warning (not with GCC 8). + ^ + +"Test_name.c", line 29: warning: returning pointer to local temporary + const int *f6() { return &make().arr[1]; } // Warning (not with GCC 8). + ^ + diff --git a/tests/tests/regressions/.gh-90.rto/default.1.1.txt b/tests/tests/regressions/.gh-90.rto/default.1.1.txt new file mode 100644 index 0000000000..30e4550776 --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.1.1.txt @@ -0,0 +1 @@ +eccp -DTEST_NUMBER=1 --c++14 Test_name.c diff --git a/tests/tests/regressions/.gh-90.rto/default.1.2.txt b/tests/tests/regressions/.gh-90.rto/default.1.2.txt new file mode 100644 index 0000000000..ff2642c6d5 --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.1.2.txt @@ -0,0 +1 @@ +./a.out diff --git a/tests/tests/regressions/.gh-90.rto/default.2.1.txt b/tests/tests/regressions/.gh-90.rto/default.2.1.txt new file mode 100644 index 0000000000..b424c530a9 --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.2.1.txt @@ -0,0 +1 @@ +eccp -DTEST_NUMBER=2 --c++20 Test_name.c diff --git a/tests/tests/regressions/.gh-90.rto/default.2.2.txt b/tests/tests/regressions/.gh-90.rto/default.2.2.txt new file mode 100644 index 0000000000..ff2642c6d5 --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.2.2.txt @@ -0,0 +1 @@ +./a.out diff --git a/tests/tests/regressions/.gh-90.rto/default.3.1.txt b/tests/tests/regressions/.gh-90.rto/default.3.1.txt new file mode 100644 index 0000000000..6a31461038 --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.3.1.txt @@ -0,0 +1 @@ +eccp -DTEST_NUMBER=3 --c++14 --g++ --gnu_version=90000 Test_name.c diff --git a/tests/tests/regressions/.gh-90.rto/default.3.2.txt b/tests/tests/regressions/.gh-90.rto/default.3.2.txt new file mode 100644 index 0000000000..ff2642c6d5 --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.3.2.txt @@ -0,0 +1 @@ +./a.out diff --git a/tests/tests/regressions/.gh-90.rto/default.4.1.txt b/tests/tests/regressions/.gh-90.rto/default.4.1.txt new file mode 100644 index 0000000000..582096beac --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.4.1.txt @@ -0,0 +1 @@ +eccp -DTEST_NUMBER=4 --c++20 --g++ --gnu_version=150000 Test_name.c diff --git a/tests/tests/regressions/.gh-90.rto/default.4.2.txt b/tests/tests/regressions/.gh-90.rto/default.4.2.txt new file mode 100644 index 0000000000..ff2642c6d5 --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.4.2.txt @@ -0,0 +1 @@ +./a.out diff --git a/tests/tests/regressions/.gh-90.rto/default.5.1.txt b/tests/tests/regressions/.gh-90.rto/default.5.1.txt new file mode 100644 index 0000000000..7a32723bd5 --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.5.1.txt @@ -0,0 +1 @@ +eccp -DTEST_NUMBER=5 --c++14 --clang --clang_version=40000 Test_name.c diff --git a/tests/tests/regressions/.gh-90.rto/default.5.2.txt b/tests/tests/regressions/.gh-90.rto/default.5.2.txt new file mode 100644 index 0000000000..ff2642c6d5 --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.5.2.txt @@ -0,0 +1 @@ +./a.out diff --git a/tests/tests/regressions/.gh-90.rto/default.6.1.txt b/tests/tests/regressions/.gh-90.rto/default.6.1.txt new file mode 100644 index 0000000000..36d2f6899d --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.6.1.txt @@ -0,0 +1 @@ +eccp -DTEST_NUMBER=6 --c++20 --clang --clang_version=190100 Test_name.c diff --git a/tests/tests/regressions/.gh-90.rto/default.6.2.txt b/tests/tests/regressions/.gh-90.rto/default.6.2.txt new file mode 100644 index 0000000000..ff2642c6d5 --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.6.2.txt @@ -0,0 +1 @@ +./a.out diff --git a/tests/tests/regressions/.gh-90.rto/default.7.1.txt b/tests/tests/regressions/.gh-90.rto/default.7.1.txt new file mode 100644 index 0000000000..d493df4c5f --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.7.1.txt @@ -0,0 +1 @@ +eccp -DTEST_NUMBER=7 --c++11 --g++ --gnu_version=90000 Test_name.c diff --git a/tests/tests/regressions/.gh-90.rto/default.7.2.txt b/tests/tests/regressions/.gh-90.rto/default.7.2.txt new file mode 100644 index 0000000000..ff2642c6d5 --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.7.2.txt @@ -0,0 +1 @@ +./a.out diff --git a/tests/tests/regressions/.gh-90.rto/default.8.1.txt b/tests/tests/regressions/.gh-90.rto/default.8.1.txt new file mode 100644 index 0000000000..3127a12b07 --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.8.1.txt @@ -0,0 +1 @@ +eccp -DTEST_NUMBER=8 --c++11 --clang --clang_version=40000 Test_name.c diff --git a/tests/tests/regressions/.gh-90.rto/default.8.2.txt b/tests/tests/regressions/.gh-90.rto/default.8.2.txt new file mode 100644 index 0000000000..ff2642c6d5 --- /dev/null +++ b/tests/tests/regressions/.gh-90.rto/default.8.2.txt @@ -0,0 +1 @@ +./a.out diff --git a/tests/tests/regressions/gh-90-old-modes.sft.cpp b/tests/tests/regressions/gh-90-old-modes.sft.cpp new file mode 100644 index 0000000000..ec95e6f196 --- /dev/null +++ b/tests/tests/regressions/gh-90-old-modes.sft.cpp @@ -0,0 +1,10 @@ +//type:fp +//options_all:--c++14 +//options:--g++ --gnu_version=80300:--clang --clang_version=30900 +// GCC before 9 and Clang before 4 do not implement Core issue 616: selecting +// a member of a class prvalue still produces a prvalue (the C++11 rule). +template struct is_prvalue { static const bool value = true; }; +template struct is_prvalue { static const bool value = false; }; +template struct is_prvalue { static const bool value = false; }; +struct A { int b; }; +static_assert(is_prvalue::value, ""); diff --git a/tests/tests/regressions/gh-90-uninit-member.sft.cpp b/tests/tests/regressions/gh-90-uninit-member.sft.cpp new file mode 100644 index 0000000000..cf22ce4dda --- /dev/null +++ b/tests/tests/regressions/gh-90-uninit-member.sft.cpp @@ -0,0 +1,17 @@ +//type:fn +//options:--c++20:--c++20 --g++ --gnu_version=150000:--c++20 --clang --clang_version=190100 +//remark:Reading an uninitialized member of a class prvalue is not constant. + +// Since C++20, a constexpr constructor can leave a member uninitialized. +// Selecting the member of a class prvalue with "." or ".*" must not treat +// the whole prvalue as initialized. + +struct W { int n; int m; constexpr W() : m(1) {} }; +constexpr int W::*pn = &W::n; +constexpr int W::*pm = &W::m; + +static_assert(W().m == 1); +static_assert((W().*pm) == 1); + +static_assert(W().n == 0); // Error. +static_assert((W().*pn) == 0); // Error. diff --git a/tests/tests/regressions/gh-90-vector-diag.sft.cpp b/tests/tests/regressions/gh-90-vector-diag.sft.cpp new file mode 100644 index 0000000000..24758e66b8 --- /dev/null +++ b/tests/tests/regressions/gh-90-vector-diag.sft.cpp @@ -0,0 +1,25 @@ +//type:fn +//options:--c++20 --g++ --gnu_version=150200:--c++20 --clang --clang_version=190100 +//remark:Reading an uninitialized element of a GNU vector is not constant. + +// Storing or copying a whole vector marks each of its elements initialized, +// so reading a whole vector requires each element to be initialized. + +typedef int v4 __attribute__((vector_size(16))); +struct X { v4 v; }; +struct Z { v4 v; constexpr Z(const v4 &a) : v(a) {} }; + +constexpr int e1() { X x; x.v[0] = 1; return x.v[2]; } +static_assert(e1() == 0); // Error. + +constexpr int e2() { X x; x.v[0] = 1; Z z(x.v); return z.v[3]; } +static_assert(e2() == 0); // Error. + +constexpr int e3() { X x; x.v[0] = 1; X y; y.v = x.v; return y.v[3]; } +static_assert(e3() == 0); // Error. + +constexpr int e4() { X x; x.v[1] = 1; X y = x; return y.v[1]; } +static_assert(e4() == 1); // Error. + +constexpr int e5() { X x; x.v[0] = 1; X y = x; return y.v[0]; } +static_assert(e5() == 1); // Error. diff --git a/tests/tests/regressions/gh-90-vector.sft.cpp b/tests/tests/regressions/gh-90-vector.sft.cpp new file mode 100644 index 0000000000..439d105793 --- /dev/null +++ b/tests/tests/regressions/gh-90-vector.sft.cpp @@ -0,0 +1,32 @@ +//type:fp +//options_all:--c++20 +//options:--g++ --gnu_version=150200:--clang --clang_version=190100 +// With Core issue 616, a GNU vector member of a class prvalue is an xvalue. +// Subscripting it in a constant expression must read the element. +typedef int v4 __attribute__((vector_size(16))); +struct X { v4 v; }; +constexpr int f() { return X{{10, 20, 30, 40}}.v[3]; } +static_assert(f() == 40); +constexpr X mk() { return X{{1, 2, 3, 4}}; } +static_assert(mk().v[1] == 2); +constexpr int g() { v4 a = {1, 2, 3, 4}; return X{a * a}.v[3]; } +static_assert(g() == 16); + +// A vector member initialized by a mem-initializer, and copies of objects +// with vector members. +struct Y { v4 v; constexpr Y(v4 a) : v(a) {} }; +constexpr int h1() { v4 a = {1, 2, 3, 4}; return Y(a).v[3]; } +static_assert(h1() == 4); +constexpr int h2() { v4 a = {1, 2, 3, 4}; Y y(a); Y z = y; return z.v[2]; } +static_assert(h2() == 3); +union U { v4 v; int i; }; +constexpr int h3() { U u{{1, 2, 3, 4}}; U w = u; return w.v[3]; } +static_assert(h3() == 4); +constexpr int h4() { v4 a = {1, 2, 3, 4}; return [a] { return a[3]; }(); } +static_assert(h4() == 4); +// An array of vectors. +constexpr int h5() { v4 a[2] = {{1, 2, 3, 4}, {5, 6, 7, 8}}; return a[1][3]; } +static_assert(h5() == 8); +// A vector member of a local object, initialized by a mem-initializer. +constexpr int h6() { v4 a = {1, 2, 3, 4}; Y y(a); return y.v[3]; } +static_assert(h6() == 4); diff --git a/tests/tests/regressions/gh-90-warn.sft.cpp b/tests/tests/regressions/gh-90-warn.sft.cpp new file mode 100644 index 0000000000..904cb57205 --- /dev/null +++ b/tests/tests/regressions/gh-90-warn.sft.cpp @@ -0,0 +1,33 @@ +//type:fp +//options:--c++20:--c++20 --g++ --gnu_version=150000:--c++20 --g++ --gnu_version=80000:--c++20 --clang --clang_version=190100:--c++11 --g++ --gnu_version=150000:--c++11 --clang --clang_version=190100 + +// Returning a reference or pointer into a member of a class prvalue returns +// a reference into a local temporary. When "A().b" is an xvalue (Core issue +// 616), that is still diagnosed, as it is when "A().b" is a prvalue. + +struct A { int b; ~A(); }; +struct R { int &r; int *p; }; +int g; + +const int &f1() { return A().b; } // Warning. +const int *f2() { return &static_cast(A().b); } // Warning. +int &&f3() { return static_cast(A()).b; } // Warning. + +// No warnings for these. +const int &n1() { return R{g, &g}.r; } +const int &n2() { return *R{g, &g}.p; } +const int &n3(A &&a) { return static_cast(a).b; } +int n4() { return A().b; } + +// A trivially destructible class prvalue is not represented by an explicit +// temporary, but a pointer into it still points into a temporary. +struct T { int b; int arr[2]; int *p; }; +T make(); + +const int *f4() { return &static_cast(make().b); } // Warning. +const int *f5() { return make().arr; } // Warning (not with GCC 8). +const int *f6() { return &make().arr[1]; } // Warning (not with GCC 8). + +// No warnings for these. +int *n5() { return make().p; } +int *n6() { return &*make().p; } diff --git a/tests/tests/regressions/gh-90.sft.cpp b/tests/tests/regressions/gh-90.sft.cpp new file mode 100644 index 0000000000..f8ac9faefd --- /dev/null +++ b/tests/tests/regressions/gh-90.sft.cpp @@ -0,0 +1,54 @@ +//type:rp +//options:--c++14:--c++20:--c++14 --g++ --gnu_version=90000:--c++20 --g++ --gnu_version=150000:--c++14 --clang --clang_version=40000:--c++20 --clang --clang_version=190100:--c++11 --g++ --gnu_version=90000:--c++11 --clang --clang_version=40000 + +// Binding a reference to a subobject of a temporary extends the lifetime of +// the whole temporary (N4140 [class.temporary]/5). In GNU and Clang modes, +// "A().b" was a prvalue (the C++11 rule), so the reference was bound to a +// copy of the member and the A temporary was destroyed at the end of the +// full-expression. GCC 9 and Clang 4 implement Core issue 616 (also in C++11 +// mode), under which "A().b" is an xvalue that designates the member of the +// temporary. + +int d; +struct A { + int b; + int i[2]; + ~A() { ++d; } +}; + +int failures; +void check(bool ok) { if (!ok) ++failures; } + +int main() { + { + const int &r = A().b; + check(d == 0); // Previously failed in GNU and Clang modes. + } + check(d == 1); + d = 0; + { + int &&r = A().b; + check(d == 0); // Previously failed in GNU and Clang modes. + } + check(d == 1); + d = 0; + { + const int &r = A().i[0]; + check(d == 0); + } + check(d == 1); + d = 0; + { + int A::*pm = &A::b; + const int &r = A().*pm; + check(d == 0); + } + check(d == 1); + d = 0; + { + int (&&r)[2] = A().i; + check(d == 0); + } + check(d == 1); + return failures; +}