From 748bb429f2d9ab4bfe2de1ecd39003cf8d07e80b Mon Sep 17 00:00:00 2001 From: Mohit Mishra Date: Sun, 4 Oct 2026 03:09:00 +0530 Subject: [PATCH 01/10] diagnose auto deduction from void more specifically. [GH #27] --- src/Changes | 12 ++++ src/error_msg.txt | 1 + src/expr.c | 59 +++++++++++++++---- tests/tests/changes/.GH27.rto/default.1.1.txt | 38 ++++++++++++ tests/tests/changes/GH27.sft.cpp | 34 +++++++++++ 5 files changed, 132 insertions(+), 12 deletions(-) create mode 100644 tests/tests/changes/.GH27.rto/default.1.1.txt create mode 100644 tests/tests/changes/GH27.sft.cpp diff --git a/src/Changes b/src/Changes index ef7a906913..6b5fb7a919 100644 --- a/src/Changes +++ b/src/Changes @@ -103,6 +103,18 @@ example, with --clang_version 230100: #pragma clang diagnostic push was previously recorded as "clangdiagnostic push". That is now fixed. +10/4/26 [GH #27] +Clearer diagnostic when auto is deduced from void + +Deducing "auto" from a void expression failed with the generic message +"cannot deduce \"auto\" type". The diagnostic now says that the type is +void. For example: + + void g(); + auto x = g(); + +decltype(auto) is unchanged: deduction succeeds and the incomplete-type +diagnostic is issued. 10/1/26 [GH #197] diff --git a/src/error_msg.txt b/src/error_msg.txt index 089cac9e4c..47100eab5b 100644 --- a/src/error_msg.txt +++ b/src/error_msg.txt @@ -3679,5 +3679,6 @@ ec_exp_interpolator;;"expected an interpolator (\"\\[\", \"\\[:\", \"\\{\", \"\\ ec_interpolated_id_is_not_identifier;;"%sq does not spell an identifier" ec_interpolated_operand_is_not_token_sequence;;"the operand of a \"\\{...}\" interpolator is not a token sequence" ec_tag_redefined_differently;;"this declaration of %n does not declare the same type as the declaration %p" +ec_cannot_deduce_auto_from_void;;"cannot deduce \"auto\" type from type \"void\"" ############################################################################### diff --git a/src/expr.c b/src/expr.c index fe8a6d57cd..03b204c907 100644 --- a/src/expr.c +++ b/src/expr.c @@ -937,6 +937,31 @@ initializer lists can have their braces ignored. } /* ignore_braces_for_placeholder_deduction */ +static an_error_code error_for_failed_auto_deduction( + a_boolean is_decltype_auto, + a_type_ptr initializer_type) +/* +Return the diagnostic for a failed placeholder-type deduction. +is_decltype_auto is TRUE when the placeholder is decltype(auto). +initializer_type is the type of the initializer, or NULL when that type is +not available (for example, a braced-init-list). +*/ +{ + an_error_code result; + + if (is_decltype_auto) { + result = ec_cannot_deduce_decltype_auto_type; + } else if (initializer_type != NULL && is_void_type(initializer_type)) { + /* void is not an object type, so deduction cannot succeed. Name that + type instead of using the generic message. */ + result = ec_cannot_deduce_auto_from_void; + } else { + result = ec_cannot_deduce_auto_type; + } /* if */ + return result; +} /* error_for_failed_auto_deduction */ + + void prescan_initializer_for_auto_type_deduction( a_decl_parse_state *dps, a_boolean parenthesized_init) @@ -1178,12 +1203,20 @@ swallowed); otherwise, it's "="-form or "{...}" form. dps->deduced_auto_type = unknown_type(); } else { /* Deduction failed. */ - expr_pos_error(dps->has_deducible_class_templ_args ? - ec_cannot_deduce_class_template_arguments : - (an_error_code)(dps->decltype_auto_specifier_seen ? - ec_cannot_deduce_decltype_auto_type : - ec_cannot_deduce_auto_type), - &dps->auto_pos); + { an_error_code err_code; + a_type_ptr init_type = NULL; + + if (dps->has_deducible_class_templ_args) { + err_code = ec_cannot_deduce_class_template_arguments; + } else { + if (icp != NULL && is_expression_component(icp)) { + init_type = operand_of_arg_list_elem(icp)->type; + } /* if */ + err_code = error_for_failed_auto_deduction( + dps->decltype_auto_specifier_seen, init_type); + } /* if */ + expr_pos_error(err_code, &dps->auto_pos); + } dps->specifiers_type = dps->deduced_auto_type = dps->type = error_type(); dps->has_deduced_type = FALSE; @@ -48752,9 +48785,9 @@ the type of element_operand and sets the variable type to the deduced type. type as it is. */ } else { /* Deduction failed. */ - pos_error(iterator->declared_with_decltype_auto ? - ec_cannot_deduce_decltype_auto_type : - ec_cannot_deduce_auto_type, + pos_error(error_for_failed_auto_deduction( + iterator->declared_with_decltype_auto, + element_operand->type), &iterator->source_corresp.decl_position); iterator->type = error_type(); } /* if */ @@ -52389,7 +52422,9 @@ are left unaffected). is_decltype_auto_case = TRUE; } /* if */ } else { - pos_error(ec_cannot_deduce_auto_type, diag_pos); + /* The declared type is not a plain "auto" (for example, "auto *"). + void still cannot be used to deduce it. */ + pos_error(ec_cannot_deduce_auto_from_void, diag_pos); deduced_return_type = error_type(); } /* if */ if (keep_placeholder) { @@ -52489,8 +52524,8 @@ type with the type of return_op. /* The type is still dependent, so leave the return type as it is. */ } else { /* Deduction failed. */ - pos_error(is_decltype_auto ? ec_cannot_deduce_decltype_auto_type - : ec_cannot_deduce_auto_type, + pos_error(error_for_failed_auto_deduction(is_decltype_auto, + return_op->type), &return_op->position); *return_type = error_type(); rout_type->variant.routine.return_type = *return_type; diff --git a/tests/tests/changes/.GH27.rto/default.1.1.txt b/tests/tests/changes/.GH27.rto/default.1.1.txt new file mode 100644 index 0000000000..6f7cef71d0 --- /dev/null +++ b/tests/tests/changes/.GH27.rto/default.1.1.txt @@ -0,0 +1,38 @@ +fe_only -DTEST_NUMBER=1 --c++23 Test_name.c +"Test_name.c", line 22: error: cannot deduce "auto" type from type "void" + auto opts = Args{}.parse(); + ^ + +"Test_name.c", line 23: error: cannot deduce "auto" type from type "void" + auto x = g(); + ^ + +"Test_name.c", line 24: error: cannot deduce "auto" type from type "void" + auto &&r = g(); + ^ + +"Test_name.c", line 25: error: cannot deduce "auto" type from type "void" + const auto c = g(); + ^ + +"Test_name.c", line 26: error: cannot deduce "auto" type from type "void" + auto *p = g(); + ^ + +"Test_name.c", line 27: error: cannot deduce "auto" type from type "void" + auto *q = new auto(g()); + ^ + +"Test_name.c", line 27: error: cannot deduce "auto" type + auto *q = new auto(g()); + ^ + +"Test_name.c", line 28: error: incomplete type "void" is not allowed + decltype(auto) d = g(); + ^ + +"Test_name.c", line 33: error: cannot deduce "auto" type from type "void" + return g(); + ^ + +9 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/GH27.sft.cpp b/tests/tests/changes/GH27.sft.cpp new file mode 100644 index 0000000000..5b1eeeb7f4 --- /dev/null +++ b/tests/tests/changes/GH27.sft.cpp @@ -0,0 +1,34 @@ +//type:fn +//options_all:--c++23 +//remark:[GH #27] Clearer diagnostic when auto deduces to void +// 10/4/26 [GH #27] +// +// Deducing auto from a void initializer used to say only +// "cannot deduce \"auto\" type". + +struct Clap { + template + auto parse(this Spec const& spec) { + } +}; + +struct Args : Clap { +}; + +void g(); + +void f() +{ + auto opts = Args{}.parse(); + auto x = g(); + auto &&r = g(); + const auto c = g(); + auto *p = g(); + auto *q = new auto(g()); + decltype(auto) d = g(); +} + +auto *h() +{ + return g(); +} From 61356ec9a3a96686763f863307b1e3efac6b5b5f Mon Sep 17 00:00:00 2001 From: Mohit Mishra Date: Tue, 6 Oct 2026 01:26:06 +0530 Subject: [PATCH 02/10] report an incomplete type when plain auto is deduced from void. [GH #27] --- src/Changes | 15 +++-- src/error_msg.txt | 1 - src/expr.c | 59 ++++--------------- src/overload.c | 32 +++++++--- tests/tests/changes/.GH27.rto/default.1.1.txt | 48 +++++++-------- tests/tests/changes/GH27.sft.cpp | 27 +++++---- .../dcl.spec.auto/.p2-1z.rto/default.1.1.txt | 4 +- .../.p11-1y.rto/default.1.1.txt | 2 +- .../stmt.ranged/.p1.rto/default.1.1.txt | 6 +- .../stmt.ranged/.p1.rto/default.2.1.txt | 6 +- .../stmt.ranged/.p1.rto/default.3.1.txt | 6 +- .../.auto-subst-failure.rto/default.1.1.txt | 10 ++-- .../.lambda-unevaluated.rto/default.1.1.txt | 4 +- .../.lambda-unevaluated.rto/default.2.1.txt | 4 +- .../default.1.1.txt | 4 +- .../default.1.1.txt | 8 +-- .../default.2.1.txt | 8 +-- 17 files changed, 99 insertions(+), 145 deletions(-) diff --git a/src/Changes b/src/Changes index 6b5fb7a919..561996b0ea 100644 --- a/src/Changes +++ b/src/Changes @@ -105,16 +105,19 @@ example, with --clang_version 230100: was previously recorded as "clangdiagnostic push". That is now fixed. 10/4/26 [GH #27] Clearer diagnostic when auto is deduced from void +10/6/26 [GH #27] +Clearer diagnostic when auto is deduced from an incomplete type -Deducing "auto" from a void expression failed with the generic message -"cannot deduce \"auto\" type". The diagnostic now says that the type is -void. For example: +Deducing a plain "auto" (including cv-qualified "auto") from void or another +incomplete type used to fail with "cannot deduce \"auto\" type". The type +is now deduced, and the usual incomplete-type diagnostic is issued, as it +already is for decltype(auto). For example: void g(); - auto x = g(); + auto x = g(); // incomplete type "void" is not allowed + auto *p = g(); // cannot deduce "auto" type -decltype(auto) is unchanged: deduction succeeds and the incomplete-type -diagnostic is issued. +Forms that are not a plain "auto", such as "auto *", still fail deduction. 10/1/26 [GH #197] diff --git a/src/error_msg.txt b/src/error_msg.txt index 47100eab5b..089cac9e4c 100644 --- a/src/error_msg.txt +++ b/src/error_msg.txt @@ -3679,6 +3679,5 @@ ec_exp_interpolator;;"expected an interpolator (\"\\[\", \"\\[:\", \"\\{\", \"\\ ec_interpolated_id_is_not_identifier;;"%sq does not spell an identifier" ec_interpolated_operand_is_not_token_sequence;;"the operand of a \"\\{...}\" interpolator is not a token sequence" ec_tag_redefined_differently;;"this declaration of %n does not declare the same type as the declaration %p" -ec_cannot_deduce_auto_from_void;;"cannot deduce \"auto\" type from type \"void\"" ############################################################################### diff --git a/src/expr.c b/src/expr.c index 03b204c907..fe8a6d57cd 100644 --- a/src/expr.c +++ b/src/expr.c @@ -937,31 +937,6 @@ initializer lists can have their braces ignored. } /* ignore_braces_for_placeholder_deduction */ -static an_error_code error_for_failed_auto_deduction( - a_boolean is_decltype_auto, - a_type_ptr initializer_type) -/* -Return the diagnostic for a failed placeholder-type deduction. -is_decltype_auto is TRUE when the placeholder is decltype(auto). -initializer_type is the type of the initializer, or NULL when that type is -not available (for example, a braced-init-list). -*/ -{ - an_error_code result; - - if (is_decltype_auto) { - result = ec_cannot_deduce_decltype_auto_type; - } else if (initializer_type != NULL && is_void_type(initializer_type)) { - /* void is not an object type, so deduction cannot succeed. Name that - type instead of using the generic message. */ - result = ec_cannot_deduce_auto_from_void; - } else { - result = ec_cannot_deduce_auto_type; - } /* if */ - return result; -} /* error_for_failed_auto_deduction */ - - void prescan_initializer_for_auto_type_deduction( a_decl_parse_state *dps, a_boolean parenthesized_init) @@ -1203,20 +1178,12 @@ swallowed); otherwise, it's "="-form or "{...}" form. dps->deduced_auto_type = unknown_type(); } else { /* Deduction failed. */ - { an_error_code err_code; - a_type_ptr init_type = NULL; - - if (dps->has_deducible_class_templ_args) { - err_code = ec_cannot_deduce_class_template_arguments; - } else { - if (icp != NULL && is_expression_component(icp)) { - init_type = operand_of_arg_list_elem(icp)->type; - } /* if */ - err_code = error_for_failed_auto_deduction( - dps->decltype_auto_specifier_seen, init_type); - } /* if */ - expr_pos_error(err_code, &dps->auto_pos); - } + expr_pos_error(dps->has_deducible_class_templ_args ? + ec_cannot_deduce_class_template_arguments : + (an_error_code)(dps->decltype_auto_specifier_seen ? + ec_cannot_deduce_decltype_auto_type : + ec_cannot_deduce_auto_type), + &dps->auto_pos); dps->specifiers_type = dps->deduced_auto_type = dps->type = error_type(); dps->has_deduced_type = FALSE; @@ -48785,9 +48752,9 @@ the type of element_operand and sets the variable type to the deduced type. type as it is. */ } else { /* Deduction failed. */ - pos_error(error_for_failed_auto_deduction( - iterator->declared_with_decltype_auto, - element_operand->type), + pos_error(iterator->declared_with_decltype_auto ? + ec_cannot_deduce_decltype_auto_type : + ec_cannot_deduce_auto_type, &iterator->source_corresp.decl_position); iterator->type = error_type(); } /* if */ @@ -52422,9 +52389,7 @@ are left unaffected). is_decltype_auto_case = TRUE; } /* if */ } else { - /* The declared type is not a plain "auto" (for example, "auto *"). - void still cannot be used to deduce it. */ - pos_error(ec_cannot_deduce_auto_from_void, diag_pos); + pos_error(ec_cannot_deduce_auto_type, diag_pos); deduced_return_type = error_type(); } /* if */ if (keep_placeholder) { @@ -52524,8 +52489,8 @@ type with the type of return_op. /* The type is still dependent, so leave the return type as it is. */ } else { /* Deduction failed. */ - pos_error(error_for_failed_auto_deduction(is_decltype_auto, - return_op->type), + pos_error(is_decltype_auto ? ec_cannot_deduce_decltype_auto_type + : ec_cannot_deduce_auto_type, &return_op->position); *return_type = error_type(); rout_type->variant.routine.return_type = *return_type; diff --git a/src/overload.c b/src/overload.c index 4eafe2f719..9ee6de6a59 100644 --- a/src/overload.c +++ b/src/overload.c @@ -65,7 +65,8 @@ static a_boolean adjust_deduction_pair( a_template_arg_ptr template_arg_list, a_type_ptr *qc_param_type, a_type_ptr *qc_arg_type, - a_boolean *consider_nondeduced); + a_boolean *consider_nondeduced, + a_boolean allow_incomplete_arg); static a_boolean check_narrowing_conversion(an_operand *source_operand, a_type_ptr dest_type, a_boolean check_enum_target, @@ -1485,7 +1486,8 @@ from previous arguments; in the standard case, it is always NULL. (an_operand *)NULL, templ_params, (a_template_arg *)NULL, (a_type_ptr*)NULL, (a_type_ptr*)NULL, - (a_boolean *)NULL) && + (a_boolean *)NULL, + /*allow_incomplete_arg=*/FALSE) && tentatively_matches_template_type(local_arg_type, local_param_type, templ_params, @@ -4272,7 +4274,8 @@ static a_boolean adjust_deduction_pair( a_template_arg_ptr template_arg_list, a_type_ptr *qc_param_type, a_type_ptr *qc_arg_type, - a_boolean *consider_nondeduced) + a_boolean *consider_nondeduced, + a_boolean allow_incomplete_arg) /* Adjust the types *p_param_type (a parameter type of a function template or a type involving the "auto" type specifier) and *p_arg_type (the type of the @@ -4295,7 +4298,10 @@ are not removed. If consider_nondeduced is non-NULL and the reason for failure is that an indefinite function matches several ways, return *consider_nondeduced TRUE. template_arg_list is used in some nonstandard modes to introduce knowledge from previous arguments; in the standard case, -it is always NULL. +it is always NULL. allow_incomplete_arg is TRUE when deducing a plain +"auto" (not, for example, "auto *"). In that case an incomplete argument +type, including void, is left for deduction so the caller can diagnose the +incomplete type instead of reporting a deduction failure. */ { a_boolean adjustment_okay = FALSE, indefinite_function_designator = FALSE; @@ -4402,8 +4408,13 @@ it is always NULL. if (is_incomplete_type(arg_type) && !is_managed_nullptr_type(arg_type)) { /* Although the managed (C++/CLI) nullptr type is incomplete and cannot be used as the type of an object, for example, the Microsoft - compiler allows it as a template argument. */ - goto done; + compiler allows it as a template argument. A plain "auto" variable + is also allowed through: the type is deduced, and the incomplete-type + diagnostic is issued for the variable (the same diagnostic as for + decltype(auto)). "auto *" and similar forms still fail deduction. */ + if (!(allow_incomplete_arg && is_template_param_type(param_type))) { + goto done; + } /* if */ } /* if */ } /* if */ /* Return the adjusted types at this point as the types that can be used to @@ -4621,7 +4632,8 @@ deduction was successful: some cases are treated as "nondeduced contexts"). elem_operand, templ_params, *template_arg_list, &qc_param_type, &qc_arg_type, - &consider_nondeduced)) { + &consider_nondeduced, + /*allow_incomplete_arg=*/FALSE)) { if (consider_nondeduced) continue; deduction_okay = FALSE; break; @@ -4775,7 +4787,8 @@ deduction succeeds, FALSE if it fails. if (!adjust_deduction_pair(¶m_type, &arg_type, operand, templ_params, *template_arg_list, &qc_param_type, &qc_arg_type, - &consider_nondeduced)) { + &consider_nondeduced, + /*allow_incomplete_arg=*/FALSE)) { if (consider_nondeduced) { /* The argument is an indefinite function that can match in more than one way. Keep going without adding anything to the template @@ -31238,7 +31251,8 @@ TRUE and FALSE is returned. if (!adjust_deduction_pair(&type, &arg_type, initializer_operand, templ_param, (a_template_arg *)NULL, &qc_param_type, &qc_arg_type, - (a_boolean *)NULL)) { + (a_boolean *)NULL, + /*allow_incomplete_arg=*/TRUE)) { okay = FALSE; } else if (!deduce_from_one_pair(type, arg_type, qc_param_type, qc_arg_type, diff --git a/tests/tests/changes/.GH27.rto/default.1.1.txt b/tests/tests/changes/.GH27.rto/default.1.1.txt index 6f7cef71d0..a070370061 100644 --- a/tests/tests/changes/.GH27.rto/default.1.1.txt +++ b/tests/tests/changes/.GH27.rto/default.1.1.txt @@ -1,38 +1,30 @@ fe_only -DTEST_NUMBER=1 --c++23 Test_name.c -"Test_name.c", line 22: error: cannot deduce "auto" type from type "void" - auto opts = Args{}.parse(); - ^ +"Test_name.c", line 27: error: incomplete type "void" is not allowed + auto v1 = void(); + ^ -"Test_name.c", line 23: error: cannot deduce "auto" type from type "void" - auto x = g(); - ^ +"Test_name.c", line 28: error: incomplete type "void" is not allowed + decltype(auto) v2 = void(); + ^ -"Test_name.c", line 24: error: cannot deduce "auto" type from type "void" - auto &&r = g(); - ^ +"Test_name.c", line 29: error: incomplete type "Incomplete" is not allowed + auto v3 = getIncomplete(); + ^ -"Test_name.c", line 25: error: cannot deduce "auto" type from type "void" - const auto c = g(); - ^ +"Test_name.c", line 30: error: incomplete type "void" is not allowed + auto opts = Args{}.parse(); + ^ -"Test_name.c", line 26: error: cannot deduce "auto" type from type "void" - auto *p = g(); +"Test_name.c", line 32: error: cannot deduce "auto" type + auto *v4 = void(); ^ -"Test_name.c", line 27: error: cannot deduce "auto" type from type "void" - auto *q = new auto(g()); - ^ - -"Test_name.c", line 27: error: cannot deduce "auto" type - auto *q = new auto(g()); +"Test_name.c", line 33: error: cannot deduce "auto" type + auto *v5 = 1; ^ -"Test_name.c", line 28: error: incomplete type "void" is not allowed - decltype(auto) d = g(); - ^ - -"Test_name.c", line 33: error: cannot deduce "auto" type from type "void" - return g(); - ^ +"Test_name.c", line 34: error: cannot deduce "auto" type + auto *p = g(); + ^ -9 errors detected in the compilation of "Test_name.c". +7 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/GH27.sft.cpp b/tests/tests/changes/GH27.sft.cpp index 5b1eeeb7f4..a1fcc06e9f 100644 --- a/tests/tests/changes/GH27.sft.cpp +++ b/tests/tests/changes/GH27.sft.cpp @@ -1,10 +1,15 @@ //type:fn //options_all:--c++23 //remark:[GH #27] Clearer diagnostic when auto deduces to void -// 10/4/26 [GH #27] +// 10/6/26 [GH #27] // -// Deducing auto from a void initializer used to say only -// "cannot deduce \"auto\" type". +// A plain auto deduced from void or another incomplete type gets the +// incomplete-type diagnostic, matching decltype(auto). auto * still +// fails deduction. + +struct Incomplete; + +struct Incomplete &getIncomplete(); struct Clap { template @@ -19,16 +24,12 @@ void g(); void f() { + auto v1 = void(); + decltype(auto) v2 = void(); + auto v3 = getIncomplete(); auto opts = Args{}.parse(); - auto x = g(); - auto &&r = g(); - const auto c = g(); - auto *p = g(); - auto *q = new auto(g()); - decltype(auto) d = g(); -} -auto *h() -{ - return g(); + auto *v4 = void(); + auto *v5 = 1; + auto *p = g(); } diff --git a/tests/tests/imported/clang/cpp/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/.p2-1z.rto/default.1.1.txt b/tests/tests/imported/clang/cpp/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/.p2-1z.rto/default.1.1.txt index 2093dc93ec..f0cee1ee14 100644 --- a/tests/tests/imported/clang/cpp/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/.p2-1z.rto/default.1.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/.p2-1z.rto/default.1.1.txt @@ -12,8 +12,8 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers ^ detected during instantiation of "auto d() [with k=0]" at line 41 -"Test_name.c", line 46: error: cannot deduce "auto" type +"Test_name.c", line 46: error: incomplete type "void" is not allowed auto e = []{ if constexpr (false) return 0; }(); // expected-error {{variable has incomplete type 'void'}} - ^ + ^ 2 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/expr/expr.prim/expr.prim.lambda/.p11-1y.rto/default.1.1.txt b/tests/tests/imported/clang/cpp/CXX/expr/expr.prim/expr.prim.lambda/.p11-1y.rto/default.1.1.txt index 4ace8ee1d9..b647b1780c 100644 --- a/tests/tests/imported/clang/cpp/CXX/expr/expr.prim/expr.prim.lambda/.p11-1y.rto/default.1.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/expr/expr.prim/expr.prim.lambda/.p11-1y.rto/default.1.1.txt @@ -31,7 +31,7 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers auto bad_init_3 = [&a(void_fn())] {}; // expected-error {{cannot form a reference to 'void'}} ^ -"Test_name.c", line 51: error: cannot deduce "auto" type +"Test_name.c", line 51: error: incomplete type "void" is not allowed auto bad_init_4 = [a(void_fn())] {}; // expected-error {{has incomplete type 'void'}} ^ diff --git a/tests/tests/imported/clang/cpp/CXX/stmt.stmt/stmt.iter/stmt.ranged/.p1.rto/default.1.1.txt b/tests/tests/imported/clang/cpp/CXX/stmt.stmt/stmt.iter/stmt.ranged/.p1.rto/default.1.1.txt index 15e659bda4..c9bd839913 100644 --- a/tests/tests/imported/clang/cpp/CXX/stmt.stmt/stmt.iter/stmt.ranged/.p1.rto/default.1.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/stmt.stmt/stmt.iter/stmt.ranged/.p1.rto/default.1.1.txt @@ -127,10 +127,6 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers for (auto u : NoEnd()) { // expected-error {{no viable 'end' function available}} ^ -"Test_name.c", line 180: error: cannot deduce "auto" type - for (auto u : NoIncr()) { // expected-error {{arithmetic on a pointer to void}}\ - ^ - "Test_name.c", line 180: error: incomplete type "void" is not allowed for (auto u : NoIncr()) { // expected-error {{arithmetic on a pointer to void}}\ ^ @@ -305,4 +301,4 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers ^ detected during instantiation of "void rdar13712739::foo(const T &) [with T=int]" at line 290 -55 errors detected in the compilation of "Test_name.c". +54 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/stmt.stmt/stmt.iter/stmt.ranged/.p1.rto/default.2.1.txt b/tests/tests/imported/clang/cpp/CXX/stmt.stmt/stmt.iter/stmt.ranged/.p1.rto/default.2.1.txt index 064f00b33e..d90e25b0b5 100644 --- a/tests/tests/imported/clang/cpp/CXX/stmt.stmt/stmt.iter/stmt.ranged/.p1.rto/default.2.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/stmt.stmt/stmt.iter/stmt.ranged/.p1.rto/default.2.1.txt @@ -127,10 +127,6 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers for (auto u : NoEnd()) { // expected-error {{no viable 'end' function available}} ^ -"Test_name.c", line 180: error: cannot deduce "auto" type - for (auto u : NoIncr()) { // expected-error {{arithmetic on a pointer to void}}\ - ^ - "Test_name.c", line 180: error: incomplete type "void" is not allowed for (auto u : NoIncr()) { // expected-error {{arithmetic on a pointer to void}}\ ^ @@ -305,4 +301,4 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers ^ detected during instantiation of "void rdar13712739::foo(const T &) [with T=int]" at line 290 -55 errors detected in the compilation of "Test_name.c". +54 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/CXX/stmt.stmt/stmt.iter/stmt.ranged/.p1.rto/default.3.1.txt b/tests/tests/imported/clang/cpp/CXX/stmt.stmt/stmt.iter/stmt.ranged/.p1.rto/default.3.1.txt index a44ef8ceaa..f5f3e7ae1e 100644 --- a/tests/tests/imported/clang/cpp/CXX/stmt.stmt/stmt.iter/stmt.ranged/.p1.rto/default.3.1.txt +++ b/tests/tests/imported/clang/cpp/CXX/stmt.stmt/stmt.iter/stmt.ranged/.p1.rto/default.3.1.txt @@ -131,10 +131,6 @@ fe_only -DTEST_NUMBER=3 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers for (auto u : NoEnd()) { // expected-error {{no viable 'end' function available}} ^ -"Test_name.c", line 180: error: cannot deduce "auto" type - for (auto u : NoIncr()) { // expected-error {{arithmetic on a pointer to void}}\ - ^ - "Test_name.c", line 180: error: incomplete type "void" is not allowed for (auto u : NoIncr()) { // expected-error {{arithmetic on a pointer to void}}\ ^ @@ -309,4 +305,4 @@ fe_only -DTEST_NUMBER=3 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers ^ detected during instantiation of "void rdar13712739::foo(const T &) [with T=int]" at line 290 -56 errors detected in the compilation of "Test_name.c". +55 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/SemaCXX/.auto-subst-failure.rto/default.1.1.txt b/tests/tests/imported/clang/cpp/SemaCXX/.auto-subst-failure.rto/default.1.1.txt index 399ce307f7..e56b038115 100644 --- a/tests/tests/imported/clang/cpp/SemaCXX/.auto-subst-failure.rto/default.1.1.txt +++ b/tests/tests/imported/clang/cpp/SemaCXX/.auto-subst-failure.rto/default.1.1.txt @@ -1,7 +1,7 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_version 999999 --c++11 Test_name.c -"Test_name.c", line 6: error: cannot deduce "auto" type +"Test_name.c", line 6: error: incomplete type "void" is not allowed auto a = f(); // expected-error {{variable has incomplete type 'void'}} - ^ + ^ "Test_name.c", line 7: error: cannot deduce "auto" type auto &b = f(); // expected-error {{cannot form a reference to 'void'}} @@ -11,9 +11,9 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers auto *c = f(); // expected-error {{incompatible initializer of type 'void'}} ^ -"Test_name.c", line 10: error: cannot deduce "auto" type +"Test_name.c", line 10: error: incomplete type "void" is not allowed auto d(f()); // expected-error {{variable has incomplete type 'void'}} - ^ + ^ "Test_name.c", line 11: error: cannot deduce "auto" type auto &&e(f()); // expected-error {{cannot form a reference to 'void'}} @@ -23,7 +23,7 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers auto *g(f()); // expected-error {{incompatible initializer of type 'void'}} ^ -"Test_name.c", line 14: error: cannot deduce "auto" type +"Test_name.c", line 14: error: incomplete type "void" is not allowed (void)new auto(f()); // expected-error {{allocation of incomplete type 'void'}} ^ diff --git a/tests/tests/imported/clang/cpp/SemaCXX/.lambda-unevaluated.rto/default.1.1.txt b/tests/tests/imported/clang/cpp/SemaCXX/.lambda-unevaluated.rto/default.1.1.txt index 2fe566454b..e86a8f1dcb 100644 --- a/tests/tests/imported/clang/cpp/SemaCXX/.lambda-unevaluated.rto/default.1.1.txt +++ b/tests/tests/imported/clang/cpp/SemaCXX/.lambda-unevaluated.rto/default.1.1.txt @@ -3,9 +3,9 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers auto g(T) -> decltype([]() { T::invalid; } ()); ^ -"Test_name.c", line 32: error: cannot deduce "auto" type +"Test_name.c", line 32: error: incomplete type "void" is not allowed auto e = g(0); // expected-error@-1{{type 'int' cannot be used prior to '::'}} - ^ + ^ "Test_name.c", line 44: error: template instantiation resulted in unexpected function type of "auto (lambda []()->int)" (the meaning of a name may have changed since the template declaration -- the type of the template is "auto (decltype(()))") foo({}); diff --git a/tests/tests/imported/clang/cpp/SemaCXX/.lambda-unevaluated.rto/default.2.1.txt b/tests/tests/imported/clang/cpp/SemaCXX/.lambda-unevaluated.rto/default.2.1.txt index 7c22b40079..0955c9f228 100644 --- a/tests/tests/imported/clang/cpp/SemaCXX/.lambda-unevaluated.rto/default.2.1.txt +++ b/tests/tests/imported/clang/cpp/SemaCXX/.lambda-unevaluated.rto/default.2.1.txt @@ -3,9 +3,9 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers auto g(T) -> decltype([]() { T::invalid; } ()); ^ -"Test_name.c", line 32: error: cannot deduce "auto" type +"Test_name.c", line 32: error: incomplete type "void" is not allowed auto e = g(0); // expected-error@-1{{type 'int' cannot be used prior to '::'}} - ^ + ^ "Test_name.c", line 44: error: template instantiation resulted in unexpected function type of "auto (lambda []()->int)" (the meaning of a name may have changed since the template declaration -- the type of the template is "auto (decltype(()))") foo({}); diff --git a/tests/tests/imported/clang/cpp/SemaCXX/.matrix-type-builtins-disabled.rto/default.1.1.txt b/tests/tests/imported/clang/cpp/SemaCXX/.matrix-type-builtins-disabled.rto/default.1.1.txt index 4df15f8570..a6cdc9dc48 100644 --- a/tests/tests/imported/clang/cpp/SemaCXX/.matrix-type-builtins-disabled.rto/default.1.1.txt +++ b/tests/tests/imported/clang/cpp/SemaCXX/.matrix-type-builtins-disabled.rto/default.1.1.txt @@ -1,6 +1,6 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_version 999999 --c++11 Test_name.c -"Test_name.c", line 8: error: cannot deduce "auto" type +"Test_name.c", line 8: error: incomplete type "void" is not allowed auto m = __builtin_matrix_column_major_load(Ptr, 2, 2, 2); - ^ + ^ 1 error detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/SemaCXX/.typeid-requires-typeinfo.rto/default.1.1.txt b/tests/tests/imported/clang/cpp/SemaCXX/.typeid-requires-typeinfo.rto/default.1.1.txt index 5b03e99261..e52f4097ed 100644 --- a/tests/tests/imported/clang/cpp/SemaCXX/.typeid-requires-typeinfo.rto/default.1.1.txt +++ b/tests/tests/imported/clang/cpp/SemaCXX/.typeid-requires-typeinfo.rto/default.1.1.txt @@ -3,12 +3,8 @@ fe_only -DTEST_NUMBER=1 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers return typeid(A); ^ -"Test_name.c", line 11: error: cannot deduce "auto" type +"Test_name.c", line 11: error: cannot convert to incomplete class "type_info" return typeid(A); ^ -"Test_name.c", line 8: error: cannot deduce "auto" type - auto f() { - ^ - -3 errors detected in the compilation of "Test_name.c". +2 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/clang/cpp/SemaCXX/.typeid-requires-typeinfo.rto/default.2.1.txt b/tests/tests/imported/clang/cpp/SemaCXX/.typeid-requires-typeinfo.rto/default.2.1.txt index f56f9f0582..806fc130d7 100644 --- a/tests/tests/imported/clang/cpp/SemaCXX/.typeid-requires-typeinfo.rto/default.2.1.txt +++ b/tests/tests/imported/clang/cpp/SemaCXX/.typeid-requires-typeinfo.rto/default.2.1.txt @@ -3,12 +3,8 @@ fe_only -DTEST_NUMBER=2 --clang -tused -e 200 --no_wrap_diagnostics --clang_vers return typeid(A); ^ -"Test_name.c", line 11: error: cannot deduce "auto" type +"Test_name.c", line 11: error: cannot convert to incomplete class "type_info" return typeid(A); ^ -"Test_name.c", line 8: error: cannot deduce "auto" type - auto f() { - ^ - -3 errors detected in the compilation of "Test_name.c". +2 errors detected in the compilation of "Test_name.c". From ed026f43a7764305e63ef4aa05be393cd766bf56 Mon Sep 17 00:00:00 2001 From: Mohit Mishra Date: Tue, 6 Oct 2026 01:36:07 +0530 Subject: [PATCH 03/10] Keep the GH #27 Changes entry above the GH #213 note. [GH #27] --- src/Changes | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Changes b/src/Changes index 561996b0ea..2d41ec8b5d 100644 --- a/src/Changes +++ b/src/Changes @@ -120,6 +120,19 @@ already is for decltype(auto). For example: Forms that are not a plain "auto", such as "auto *", still fail deduction. +10/5/26 [GH #213] +White space lost in the pragma text for a "#pragma clang" directive + +The changes for EDGcpfe/29033 (in version 7.0) introduced a regression in +which the text recorded in the IL for a "#pragma clang" directive other than +"#pragma clang riscv ..." lost the white space following "clang". For +example, with --clang_version 230100: + + #pragma clang diagnostic push + +was previously recorded as "clangdiagnostic push". That is now fixed. + + 10/1/26 [GH #197] Deducing noexcept-specifiers From bcef7db9c1c0c6909e589b69d95eeffe1b141f34 Mon Sep 17 00:00:00 2001 From: Mohit Mishra Date: Tue, 6 Oct 2026 09:57:52 +0530 Subject: [PATCH 04/10] Keep the GH #27 Changes entry at the top of version 7.1. [GH #27] --- src/Changes | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/src/Changes b/src/Changes index 2d41ec8b5d..1e19309c37 100644 --- a/src/Changes +++ b/src/Changes @@ -53,6 +53,19 @@ such object files failed. For example, with --g++: This is now fixed: When generating code targeting GCC, the C-generating back end now preserves the __weak__ attribute and suppresses the __always_inline__ attribute instead. +10/6/26 [GH #27] +Clearer diagnostic when auto is deduced from an incomplete type + +Deducing a plain "auto" (including cv-qualified "auto") from void or another +incomplete type used to fail with "cannot deduce \"auto\" type". The type +is now deduced, and the usual incomplete-type diagnostic is issued, as it +already is for decltype(auto). For example: + + void g(); + auto x = g(); // incomplete type "void" is not allowed + auto *p = g(); // cannot deduce "auto" type + +Forms that are not a plain "auto", such as "auto *", still fail deduction. 10/5/26 [GH #195] @@ -92,34 +105,6 @@ That is now fixed: The missing argument is still diagnosed, and the code after the pragma is parsed. -10/5/26 [GH #213] -White space lost in the pragma text for a "#pragma clang" directive - -The changes for EDGcpfe/29033 (in version 7.0) introduced a regression in -which the text recorded in the IL for a "#pragma clang" directive other than -"#pragma clang riscv ..." lost the white space following "clang". For -example, with --clang_version 230100: - - #pragma clang diagnostic push - -was previously recorded as "clangdiagnostic push". That is now fixed. -10/4/26 [GH #27] -Clearer diagnostic when auto is deduced from void -10/6/26 [GH #27] -Clearer diagnostic when auto is deduced from an incomplete type - -Deducing a plain "auto" (including cv-qualified "auto") from void or another -incomplete type used to fail with "cannot deduce \"auto\" type". The type -is now deduced, and the usual incomplete-type diagnostic is issued, as it -already is for decltype(auto). For example: - - void g(); - auto x = g(); // incomplete type "void" is not allowed - auto *p = g(); // cannot deduce "auto" type - -Forms that are not a plain "auto", such as "auto *", still fail deduction. - - 10/5/26 [GH #213] White space lost in the pragma text for a "#pragma clang" directive From 90a5e262e16bafbe1a245bc41950987b15b2ff0b Mon Sep 17 00:00:00 2001 From: Mohit Mishra Date: Tue, 6 Oct 2026 20:50:17 +0530 Subject: [PATCH 05/10] Address review comments on the incomplete-auto deduction change. [GH #27] --- src/Changes | 10 +++++----- src/overload.c | 20 ++++++++------------ 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/Changes b/src/Changes index 1e19309c37..3d80ebfdee 100644 --- a/src/Changes +++ b/src/Changes @@ -57,13 +57,13 @@ attribute instead. Clearer diagnostic when auto is deduced from an incomplete type Deducing a plain "auto" (including cv-qualified "auto") from void or another -incomplete type used to fail with "cannot deduce \"auto\" type". The type -is now deduced, and the usual incomplete-type diagnostic is issued, as it -already is for decltype(auto). For example: +incomplete type used to be reported as a deduction failure. The type is now +deduced, and the usual incomplete-type diagnostic is issued, as it already +is for decltype(auto). For example: void g(); - auto x = g(); // incomplete type "void" is not allowed - auto *p = g(); // cannot deduce "auto" type + auto x = g(); // Error: incomplete type "void" is not allowed + auto *p = g(); // Error: cannot deduce "auto" type Forms that are not a plain "auto", such as "auto *", still fail deduction. diff --git a/src/overload.c b/src/overload.c index 9ee6de6a59..3693285b61 100644 --- a/src/overload.c +++ b/src/overload.c @@ -4298,10 +4298,10 @@ are not removed. If consider_nondeduced is non-NULL and the reason for failure is that an indefinite function matches several ways, return *consider_nondeduced TRUE. template_arg_list is used in some nonstandard modes to introduce knowledge from previous arguments; in the standard case, -it is always NULL. allow_incomplete_arg is TRUE when deducing a plain -"auto" (not, for example, "auto *"). In that case an incomplete argument -type, including void, is left for deduction so the caller can diagnose the -incomplete type instead of reporting a deduction failure. +it is always NULL. allow_incomplete_arg allows an incomplete argument +type (including void) to be used for deduction. It is used for placeholder +type deduction, where an incomplete type error is diagnosed by the caller +instead of a deduction failure. */ { a_boolean adjustment_okay = FALSE, indefinite_function_designator = FALSE; @@ -4405,16 +4405,12 @@ incomplete type instead of reporting a deduction failure. void m() { f(*p); } */ complete_type_is_needed(arg_type); - if (is_incomplete_type(arg_type) && !is_managed_nullptr_type(arg_type)) { + if (is_incomplete_type(arg_type) && !is_managed_nullptr_type(arg_type) && + !allow_incomplete_arg) { /* Although the managed (C++/CLI) nullptr type is incomplete and cannot be used as the type of an object, for example, the Microsoft - compiler allows it as a template argument. A plain "auto" variable - is also allowed through: the type is deduced, and the incomplete-type - diagnostic is issued for the variable (the same diagnostic as for - decltype(auto)). "auto *" and similar forms still fail deduction. */ - if (!(allow_incomplete_arg && is_template_param_type(param_type))) { - goto done; - } /* if */ + compiler allows it as a template argument. */ + goto done; } /* if */ } /* if */ /* Return the adjusted types at this point as the types that can be used to From aef05b9a177c8f1bc44671d89553132cca29b735 Mon Sep 17 00:00:00 2001 From: Mohit Mishra Date: Wed, 7 Oct 2026 15:18:35 +0530 Subject: [PATCH 06/10] Update recordings for auto deduction from an incomplete type. [GH #27] --- src/overload.c | 7 ++++++- .../clang/cpp/SemaCXX/.PR172001.rto/default.3.1.txt | 4 ++-- .../gnu/cpp/cpp0x/.constexpr-77482.rto/default.1.1.txt | 4 ++-- .../imported/gnu/cpp/cpp1y/.auto-fn27.rto/default.1.1.txt | 4 ++-- .../cpp1y/.lambda-generic-variadic22.rto/default.1.1.txt | 4 ++-- .../gnu/cpp/cpp2a/.nontype-class64.rto/default.1.1.txt | 2 +- .../cpp/cpp2a/.spaceship-synth-neg4.rto/default.1.1.txt | 4 ++-- .../cpp2a/.spaceship-synth-neg4.rto/edg_x86_32_cp.1.1.txt | 4 ++-- 8 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/overload.c b/src/overload.c index 3693285b61..169eaf054f 100644 --- a/src/overload.c +++ b/src/overload.c @@ -31244,11 +31244,16 @@ TRUE and FALSE is returned. /* Adjust the argument and parameter types for deduction. Some types can never succeed: Issue an error and don't attempt deduction any further. */ + /* In a prototype instantiation a deduction failure is often + suppressed. Keep that behavior for an incomplete initializer: + the incomplete-type diagnostic is issued at instantiation. */ + a_boolean allow_incomplete_arg = + !scope_stack_top().in_prototype_instantiation; if (!adjust_deduction_pair(&type, &arg_type, initializer_operand, templ_param, (a_template_arg *)NULL, &qc_param_type, &qc_arg_type, (a_boolean *)NULL, - /*allow_incomplete_arg=*/TRUE)) { + allow_incomplete_arg)) { okay = FALSE; } else if (!deduce_from_one_pair(type, arg_type, qc_param_type, qc_arg_type, diff --git a/tests/tests/imported/clang/cpp/SemaCXX/.PR172001.rto/default.3.1.txt b/tests/tests/imported/clang/cpp/SemaCXX/.PR172001.rto/default.3.1.txt index fea687f11f..caa30aca31 100644 --- a/tests/tests/imported/clang/cpp/SemaCXX/.PR172001.rto/default.3.1.txt +++ b/tests/tests/imported/clang/cpp/SemaCXX/.PR172001.rto/default.3.1.txt @@ -1,6 +1,6 @@ fe_only -DTEST_NUMBER=3 --clang -tused -e 200 --no_wrap_diagnostics --clang_version 999999 --c++20 -DTEST3 Test_name.c -"Test_name.c", line 46: error: cannot deduce "auto" type +"Test_name.c", line 46: error: incomplete type "std::partial_ordering" is not allowed auto res = a <=> b; - ^ + ^ 1 error detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/gnu/cpp/cpp0x/.constexpr-77482.rto/default.1.1.txt b/tests/tests/imported/gnu/cpp/cpp0x/.constexpr-77482.rto/default.1.1.txt index a5c6b6eddd..25593e1039 100644 --- a/tests/tests/imported/gnu/cpp/cpp0x/.constexpr-77482.rto/default.1.1.txt +++ b/tests/tests/imported/gnu/cpp/cpp0x/.constexpr-77482.rto/default.1.1.txt @@ -3,8 +3,8 @@ fe_only -DTEST_NUMBER=1 --gnu_version=999999 -tused -e 200 --no_wrap --no_wrap_d constexpr auto x; // { dg-error "declaration\[^\n\r]*has no initializer" } ^ -"Test_name.c", line 8: error: cannot deduce "auto" type +"Test_name.c", line 8: error: incomplete type "const S" is not allowed constexpr auto y = s; // { dg-error "incomplete" } - ^ + ^ 2 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/gnu/cpp/cpp1y/.auto-fn27.rto/default.1.1.txt b/tests/tests/imported/gnu/cpp/cpp1y/.auto-fn27.rto/default.1.1.txt index 8a0ff003fc..afe1294546 100644 --- a/tests/tests/imported/gnu/cpp/cpp1y/.auto-fn27.rto/default.1.1.txt +++ b/tests/tests/imported/gnu/cpp/cpp1y/.auto-fn27.rto/default.1.1.txt @@ -6,9 +6,9 @@ fe_only -DTEST_NUMBER=1 --gnu_version=999999 -tused -e 200 --no_wrap --no_wrap_d instantiation of "auto A<>::run(F, R, T) [with =0, F=J::K, R=int, T=int]" at line 14 instantiation of "auto foo(F, T) [with F=J::K, T=int]" at line 36 -"Test_name.c", line 36: error: cannot deduce "auto" type +"Test_name.c", line 36: error: incomplete type "void" is not allowed auto u =[&](L) { auto t = foo (J::K (), 0); }; // { dg-error "25:incomplete|void" } - ^ + ^ detected during instantiation of "void F::bar(const F::G &) [with C=C]" 2 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/gnu/cpp/cpp1y/.lambda-generic-variadic22.rto/default.1.1.txt b/tests/tests/imported/gnu/cpp/cpp1y/.lambda-generic-variadic22.rto/default.1.1.txt index e0b53fe3ed..97d473fa0e 100644 --- a/tests/tests/imported/gnu/cpp/cpp1y/.lambda-generic-variadic22.rto/default.1.1.txt +++ b/tests/tests/imported/gnu/cpp/cpp1y/.lambda-generic-variadic22.rto/default.1.1.txt @@ -7,9 +7,9 @@ fe_only -DTEST_NUMBER=1 --gnu_version=999999 -tused -e 200 --no_wrap --no_wrap_d int x[][i] = { 0 }; // { dg-error "not expanded" } ^ -"Test_name.c", line 9: error: cannot deduce "auto" type +"Test_name.c", line 9: error: incomplete type "void" is not allowed auto a = [](auto ... i) // { dg-prune-output "incomplete" } - ^ + ^ detected during instantiation of "auto f(T) [with T=int]" at line 16 2 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/gnu/cpp/cpp2a/.nontype-class64.rto/default.1.1.txt b/tests/tests/imported/gnu/cpp/cpp2a/.nontype-class64.rto/default.1.1.txt index 5b91fb15f8..cf15c5c3f2 100644 --- a/tests/tests/imported/gnu/cpp/cpp2a/.nontype-class64.rto/default.1.1.txt +++ b/tests/tests/imported/gnu/cpp/cpp2a/.nontype-class64.rto/default.1.1.txt @@ -1,5 +1,5 @@ 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 10: error: cannot deduce "auto" template parameter type "auto" from "void" +"Test_name.c", line 10: error: a template parameter may not have void type B b4; // { dg-error "void" } ^ diff --git a/tests/tests/imported/gnu/cpp/cpp2a/.spaceship-synth-neg4.rto/default.1.1.txt b/tests/tests/imported/gnu/cpp/cpp2a/.spaceship-synth-neg4.rto/default.1.1.txt index da605104b9..684af4bdcd 100644 --- a/tests/tests/imported/gnu/cpp/cpp2a/.spaceship-synth-neg4.rto/default.1.1.txt +++ b/tests/tests/imported/gnu/cpp/cpp2a/.spaceship-synth-neg4.rto/default.1.1.txt @@ -3,8 +3,8 @@ fe_only -DTEST_NUMBER=1 --gnu_version=999999 -tused -e 200 --no_wrap --no_wrap_d auto x = B() <=> B(); ^ -"./cpp2a/spaceship-synth-neg4.C", line 19: error: cannot deduce "auto" type +"./cpp2a/spaceship-synth-neg4.C", line 19: error: incomplete type "void" is not allowed auto x = B() <=> B(); - ^ + ^ 2 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/imported/gnu/cpp/cpp2a/.spaceship-synth-neg4.rto/edg_x86_32_cp.1.1.txt b/tests/tests/imported/gnu/cpp/cpp2a/.spaceship-synth-neg4.rto/edg_x86_32_cp.1.1.txt index 27c064ca4a..b42d468fde 100644 --- a/tests/tests/imported/gnu/cpp/cpp2a/.spaceship-synth-neg4.rto/edg_x86_32_cp.1.1.txt +++ b/tests/tests/imported/gnu/cpp/cpp2a/.spaceship-synth-neg4.rto/edg_x86_32_cp.1.1.txt @@ -7,8 +7,8 @@ fe_only -DTEST_NUMBER=1 --gnu_version=999999 -tused -e 200 --no_wrap --no_wrap_d auto x = B() <=> B(); ^ -"./cpp2a/spaceship-synth-neg4.C", line 19: error: cannot deduce "auto" type +"./cpp2a/spaceship-synth-neg4.C", line 19: error: incomplete type "void" is not allowed auto x = B() <=> B(); - ^ + ^ 3 errors detected in the compilation of "Test_name.c". From 3056726cac3857908148ba21ddf7867db8c76b05 Mon Sep 17 00:00:00 2001 From: Mohit Mishra Date: Thu, 8 Oct 2026 10:27:14 +0530 Subject: [PATCH 07/10] Show why incomplete auto is not diagnosed in a template definition. [GH #27] --- src/Changes | 2 ++ src/overload.c | 8 +++-- tests/tests/changes/.GH27.rto/default.2.1.txt | 30 +++++++++++++++++++ tests/tests/changes/GH27.sft.cpp | 22 +++++++++++++- 4 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 tests/tests/changes/.GH27.rto/default.2.1.txt diff --git a/src/Changes b/src/Changes index 3d80ebfdee..4941988908 100644 --- a/src/Changes +++ b/src/Changes @@ -66,6 +66,8 @@ is for decltype(auto). For example: auto *p = g(); // Error: cannot deduce "auto" type Forms that are not a plain "auto", such as "auto *", still fail deduction. +The diagnostic is not issued while scanning a template definition, because +the initializer type may be completed before the template is instantiated. 10/5/26 [GH #195] diff --git a/src/overload.c b/src/overload.c index 169eaf054f..20a4040bee 100644 --- a/src/overload.c +++ b/src/overload.c @@ -31244,9 +31244,11 @@ TRUE and FALSE is returned. /* Adjust the argument and parameter types for deduction. Some types can never succeed: Issue an error and don't attempt deduction any further. */ - /* In a prototype instantiation a deduction failure is often - suppressed. Keep that behavior for an incomplete initializer: - the incomplete-type diagnostic is issued at instantiation. */ + /* Do not deduce an incomplete type while scanning a template + definition. The type may be completed before instantiation, and + a deduction failure here is suppressed in GNU and Microsoft modes. + Diagnosing an incomplete type instead would reject a valid + template. See GH27. */ a_boolean allow_incomplete_arg = !scope_stack_top().in_prototype_instantiation; if (!adjust_deduction_pair(&type, &arg_type, initializer_operand, diff --git a/tests/tests/changes/.GH27.rto/default.2.1.txt b/tests/tests/changes/.GH27.rto/default.2.1.txt new file mode 100644 index 0000000000..6b99f2951f --- /dev/null +++ b/tests/tests/changes/.GH27.rto/default.2.1.txt @@ -0,0 +1,30 @@ +fe_only -DTEST_NUMBER=2 --c++23 --gnu_version=999999 -DSHOW_TEMPLATE_DEFN Test_name.c +"Test_name.c", line 27: error: incomplete type "void" is not allowed + auto v1 = void(); + ^ + +"Test_name.c", line 28: error: incomplete type "void" is not allowed + decltype(auto) v2 = void(); + ^ + +"Test_name.c", line 29: error: incomplete type "Incomplete" is not allowed + auto v3 = getIncomplete(); + ^ + +"Test_name.c", line 30: error: incomplete type "void" is not allowed + auto opts = Args{}.parse(); + ^ + +"Test_name.c", line 32: error: cannot deduce "auto" type + auto *v4 = void(); + ^ + +"Test_name.c", line 33: error: cannot deduce "auto" type + auto *v5 = 1; + ^ + +"Test_name.c", line 34: error: cannot deduce "auto" type + auto *p = g(); + ^ + +7 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/GH27.sft.cpp b/tests/tests/changes/GH27.sft.cpp index a1fcc06e9f..39c2fd7fd1 100644 --- a/tests/tests/changes/GH27.sft.cpp +++ b/tests/tests/changes/GH27.sft.cpp @@ -1,5 +1,5 @@ //type:fn -//options_all:--c++23 +//options:--c++23:--c++23 --gnu_version=999999 -DSHOW_TEMPLATE_DEFN //remark:[GH #27] Clearer diagnostic when auto deduces to void // 10/6/26 [GH #27] // @@ -33,3 +33,23 @@ void f() auto *v5 = 1; auto *p = g(); } + +#if SHOW_TEMPLATE_DEFN +/* Incomplete in the template definition, complete before instantiation. + The definition must not be rejected. */ +struct Later; +extern Later later_obj; + +template +void use_later() +{ + auto x = later_obj; +} + +struct Later { int n; }; + +void call_later() +{ + use_later<0>(); +} +#endif /* SHOW_TEMPLATE_DEFN */ From a629bee9a22448930a6c6f65b5d29651b705257e Mon Sep 17 00:00:00 2001 From: Mohit Mishra Date: Thu, 8 Oct 2026 10:30:38 +0530 Subject: [PATCH 08/10] Place the GH #27 Changes entry above the GH #203 note. [GH #27] --- src/Changes | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/Changes b/src/Changes index 4941988908..2d239cb061 100644 --- a/src/Changes +++ b/src/Changes @@ -53,6 +53,8 @@ such object files failed. For example, with --g++: This is now fixed: When generating code targeting GCC, the C-generating back end now preserves the __weak__ attribute and suppresses the __always_inline__ attribute instead. + + 10/6/26 [GH #27] Clearer diagnostic when auto is deduced from an incomplete type @@ -70,6 +72,23 @@ The diagnostic is not issued while scanning a template definition, because the initializer type may be completed before the template is instantiated. +10/6/26 [GH #203] +Assertion failure on an empty diag_suppress pragma + +A diag_suppress (or similar) pragma with no arguments, or with a trailing +comma, diagnosed the missing argument and then read past the end of the +directive. That, in turn, could lead to an assertion failure in +process_immediate_pragmas. For example: + + #pragma diagnostic push + #pragma diag_suppress + int f() { int a; return a; } + #pragma diagnostic pop + +That is now fixed: The missing argument is still diagnosed, and the code after +the pragma is parsed. + + 10/5/26 [GH #195] C++-generating back end: dependent multi-dimensional subscripts @@ -90,21 +109,6 @@ C++-generating back end: inaccessible or out-of-scope template arguments In certain complex cases, the C++-generating back end could put out a template argument that uses an inaccessible or out-of-scope name, making the generated code uncompilable. This is now fixed. -10/6/26 [GH #203] -Assertion failure on an empty diag_suppress pragma - -A diag_suppress (or similar) pragma with no arguments, or with a trailing -comma, diagnosed the missing argument and then read past the end of the -directive. That, in turn, could lead to an assertion failure in -process_immediate_pragmas. For example: - - #pragma diagnostic push - #pragma diag_suppress - int f() { int a; return a; } - #pragma diagnostic pop - -That is now fixed: The missing argument is still diagnosed, and the code after -the pragma is parsed. 10/5/26 [GH #213] From d6f56181e9f6a6047e569ed89d99562669496ec2 Mon Sep 17 00:00:00 2001 From: Mohit Mishra Date: Thu, 8 Oct 2026 16:55:40 +0530 Subject: [PATCH 09/10] Keep incomplete-type errors in template definitions outside GNU and Microsoft modes. [GH #27] --- src/Changes | 2 - src/overload.c | 13 ++++--- tests/tests/changes/.GH27.rto/default.2.1.txt | 30 --------------- .../tests/changes/.GH27_a.rto/default.1.1.txt | 14 +++++++ .../tests/changes/.GH27_a.rto/default.2.1.txt | 6 +++ .../tests/changes/.GH27_a.rto/default.3.1.txt | 6 +++ .../tests/changes/.GH27_a.rto/default.4.1.txt | 6 +++ .../changes/.GH27_a.rto/edg_x86_64_cp.3.1.txt | 14 +++++++ tests/tests/changes/GH27.sft.cpp | 21 +---------- tests/tests/changes/GH27_a.sft.cpp | 37 +++++++++++++++++++ 10 files changed, 91 insertions(+), 58 deletions(-) delete mode 100644 tests/tests/changes/.GH27.rto/default.2.1.txt create mode 100644 tests/tests/changes/.GH27_a.rto/default.1.1.txt create mode 100644 tests/tests/changes/.GH27_a.rto/default.2.1.txt create mode 100644 tests/tests/changes/.GH27_a.rto/default.3.1.txt create mode 100644 tests/tests/changes/.GH27_a.rto/default.4.1.txt create mode 100644 tests/tests/changes/.GH27_a.rto/edg_x86_64_cp.3.1.txt create mode 100644 tests/tests/changes/GH27_a.sft.cpp diff --git a/src/Changes b/src/Changes index 2d239cb061..e8fa0a90fa 100644 --- a/src/Changes +++ b/src/Changes @@ -68,8 +68,6 @@ is for decltype(auto). For example: auto *p = g(); // Error: cannot deduce "auto" type Forms that are not a plain "auto", such as "auto *", still fail deduction. -The diagnostic is not issued while scanning a template definition, because -the initializer type may be completed before the template is instantiated. 10/6/26 [GH #203] diff --git a/src/overload.c b/src/overload.c index 20a4040bee..57d3973e66 100644 --- a/src/overload.c +++ b/src/overload.c @@ -31244,13 +31244,14 @@ TRUE and FALSE is returned. /* Adjust the argument and parameter types for deduction. Some types can never succeed: Issue an error and don't attempt deduction any further. */ - /* Do not deduce an incomplete type while scanning a template - definition. The type may be completed before instantiation, and - a deduction failure here is suppressed in GNU and Microsoft modes. - Diagnosing an incomplete type instead would reject a valid - template. See GH27. */ + /* GCC and Microsoft don't diagnose incomplete-type errors in template + definitions, but for now the only way for us to emulate that is by + failing deduction in these cases (which we then allow, see + prescan_initializer_for_auto_type_deduction). */ a_boolean allow_incomplete_arg = - !scope_stack_top().in_prototype_instantiation; + !((gpp_version_is(any_version) || ms_version_is(any_version)) && + scope_stack_top().in_prototype_instantiation && + innermost_function_scope != NULL); if (!adjust_deduction_pair(&type, &arg_type, initializer_operand, templ_param, (a_template_arg *)NULL, &qc_param_type, &qc_arg_type, diff --git a/tests/tests/changes/.GH27.rto/default.2.1.txt b/tests/tests/changes/.GH27.rto/default.2.1.txt deleted file mode 100644 index 6b99f2951f..0000000000 --- a/tests/tests/changes/.GH27.rto/default.2.1.txt +++ /dev/null @@ -1,30 +0,0 @@ -fe_only -DTEST_NUMBER=2 --c++23 --gnu_version=999999 -DSHOW_TEMPLATE_DEFN Test_name.c -"Test_name.c", line 27: error: incomplete type "void" is not allowed - auto v1 = void(); - ^ - -"Test_name.c", line 28: error: incomplete type "void" is not allowed - decltype(auto) v2 = void(); - ^ - -"Test_name.c", line 29: error: incomplete type "Incomplete" is not allowed - auto v3 = getIncomplete(); - ^ - -"Test_name.c", line 30: error: incomplete type "void" is not allowed - auto opts = Args{}.parse(); - ^ - -"Test_name.c", line 32: error: cannot deduce "auto" type - auto *v4 = void(); - ^ - -"Test_name.c", line 33: error: cannot deduce "auto" type - auto *v5 = 1; - ^ - -"Test_name.c", line 34: error: cannot deduce "auto" type - auto *p = g(); - ^ - -7 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/.GH27_a.rto/default.1.1.txt b/tests/tests/changes/.GH27_a.rto/default.1.1.txt new file mode 100644 index 0000000000..2156e3a6ad --- /dev/null +++ b/tests/tests/changes/.GH27_a.rto/default.1.1.txt @@ -0,0 +1,14 @@ +fe_only -DTEST_NUMBER=1 --c++11 -A Test_name.c +"Test_name.c", line 14: error: incomplete type "void" is not allowed + auto v = void(); + ^ + +"Test_name.c", line 20: error: incomplete type "void" is not allowed + auto v = void(); + ^ + +"Test_name.c", line 29: error: incomplete type "Later" is not allowed + auto x = later_obj; + ^ + +3 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/.GH27_a.rto/default.2.1.txt b/tests/tests/changes/.GH27_a.rto/default.2.1.txt new file mode 100644 index 0000000000..6d4edc9b57 --- /dev/null +++ b/tests/tests/changes/.GH27_a.rto/default.2.1.txt @@ -0,0 +1,6 @@ +fe_only -DTEST_NUMBER=2 --c++11 --gnu_version 160200 Test_name.c +"Test_name.c", line 14: error: incomplete type "void" is not allowed + auto v = void(); + ^ + +1 error detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/.GH27_a.rto/default.3.1.txt b/tests/tests/changes/.GH27_a.rto/default.3.1.txt new file mode 100644 index 0000000000..017ea17d38 --- /dev/null +++ b/tests/tests/changes/.GH27_a.rto/default.3.1.txt @@ -0,0 +1,6 @@ +fe_only -DTEST_NUMBER=3 --c++11 --clang_version 230100 Test_name.c +"Test_name.c", line 14: error: incomplete type "void" is not allowed + auto v = void(); + ^ + +1 error detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/.GH27_a.rto/default.4.1.txt b/tests/tests/changes/.GH27_a.rto/default.4.1.txt new file mode 100644 index 0000000000..5554ecddc8 --- /dev/null +++ b/tests/tests/changes/.GH27_a.rto/default.4.1.txt @@ -0,0 +1,6 @@ +fe_only -DTEST_NUMBER=4 --ms_c++20 --microsoft_version 1951 Test_name.c +"Test_name.c", line 14: error: incomplete type "void" is not allowed + auto v = void(); + ^ + +1 error detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/.GH27_a.rto/edg_x86_64_cp.3.1.txt b/tests/tests/changes/.GH27_a.rto/edg_x86_64_cp.3.1.txt new file mode 100644 index 0000000000..ed724fdc2f --- /dev/null +++ b/tests/tests/changes/.GH27_a.rto/edg_x86_64_cp.3.1.txt @@ -0,0 +1,14 @@ +fe_only -DTEST_NUMBER=3 --c++11 --clang_version 230100 Test_name.c +"Test_name.c", line 14: error: incomplete type "void" is not allowed + auto v = void(); + ^ + +"Test_name.c", line 20: error: incomplete type "void" is not allowed + auto v = void(); + ^ + +"Test_name.c", line 29: error: incomplete type "Later" is not allowed + auto x = later_obj; + ^ + +3 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/GH27.sft.cpp b/tests/tests/changes/GH27.sft.cpp index 39c2fd7fd1..3dcc160b91 100644 --- a/tests/tests/changes/GH27.sft.cpp +++ b/tests/tests/changes/GH27.sft.cpp @@ -1,5 +1,5 @@ //type:fn -//options:--c++23:--c++23 --gnu_version=999999 -DSHOW_TEMPLATE_DEFN +//options:--c++23 //remark:[GH #27] Clearer diagnostic when auto deduces to void // 10/6/26 [GH #27] // @@ -34,22 +34,3 @@ void f() auto *p = g(); } -#if SHOW_TEMPLATE_DEFN -/* Incomplete in the template definition, complete before instantiation. - The definition must not be rejected. */ -struct Later; -extern Later later_obj; - -template -void use_later() -{ - auto x = later_obj; -} - -struct Later { int n; }; - -void call_later() -{ - use_later<0>(); -} -#endif /* SHOW_TEMPLATE_DEFN */ diff --git a/tests/tests/changes/GH27_a.sft.cpp b/tests/tests/changes/GH27_a.sft.cpp new file mode 100644 index 0000000000..cd3896ba4f --- /dev/null +++ b/tests/tests/changes/GH27_a.sft.cpp @@ -0,0 +1,37 @@ +//type:fn +//options:--c++11 -A:--c++11 --gnu_version 160200:--c++11 --clang_version 230100:--ms_c++20 --microsoft_version 1951 +//remark:[GH #27] Incomplete auto deduction in a template definition +// 10/6/26 [GH #27] +// +// In standard and Clang modes, a plain auto deduced from an incomplete +// type in a template definition gets the incomplete-type diagnostic. GCC +// and Microsoft don't diagnose that in a template definition, so in GNU and +// Microsoft modes the definition is still accepted. Outside a template, +// the incomplete-type diagnostic is issued in every mode. + +void not_a_template() +{ + auto v = void(); +} + +template +void use_void() +{ + auto v = void(); +} + +struct Later; +extern Later later_obj; + +template +void use_later() +{ + auto x = later_obj; +} + +struct Later { int n; }; + +void call_later() +{ + use_later<0>(); +} From 4589f92963322073ed2a6580f4045a41f9c4e257 Mon Sep 17 00:00:00 2001 From: Mohit Mishra Date: Fri, 9 Oct 2026 01:03:47 +0530 Subject: [PATCH 10/10] Add only the GH #27 entry to Changes and record GH27_a for edg_x86_32_cp. [GH #27] --- src/Changes | 62 +++++++++---------- .../changes/.GH27_a.rto/edg_x86_32_cp.3.1.txt | 14 +++++ tests/tests/changes/GH27.sft.cpp | 2 +- tests/tests/changes/GH27_a.sft.cpp | 2 +- 4 files changed, 46 insertions(+), 34 deletions(-) create mode 100644 tests/tests/changes/.GH27_a.rto/edg_x86_32_cp.3.1.txt diff --git a/src/Changes b/src/Changes index e8fa0a90fa..0734f50f32 100644 --- a/src/Changes +++ b/src/Changes @@ -1,5 +1,20 @@ Version 7.1 +10/9/26 [GH #27] +Clearer diagnostic when auto is deduced from an incomplete type + +Deducing a plain "auto" (including cv-qualified "auto") from void or another +incomplete type used to be reported as a deduction failure. The type is now +deduced, and the usual incomplete-type diagnostic is issued, as it already +is for decltype(auto). For example: + + void g(); + auto x = g(); // Error: incomplete type "void" is not allowed + auto *p = g(); // Error: cannot deduce "auto" type + +Forms that are not a plain "auto", such as "auto *", still fail deduction. + + 10/7/26 [GH #176] C-generating back end: always_inline attribute and inlined setjmp calls @@ -55,38 +70,6 @@ end now preserves the __weak__ attribute and suppresses the __always_inline__ attribute instead. -10/6/26 [GH #27] -Clearer diagnostic when auto is deduced from an incomplete type - -Deducing a plain "auto" (including cv-qualified "auto") from void or another -incomplete type used to be reported as a deduction failure. The type is now -deduced, and the usual incomplete-type diagnostic is issued, as it already -is for decltype(auto). For example: - - void g(); - auto x = g(); // Error: incomplete type "void" is not allowed - auto *p = g(); // Error: cannot deduce "auto" type - -Forms that are not a plain "auto", such as "auto *", still fail deduction. - - -10/6/26 [GH #203] -Assertion failure on an empty diag_suppress pragma - -A diag_suppress (or similar) pragma with no arguments, or with a trailing -comma, diagnosed the missing argument and then read past the end of the -directive. That, in turn, could lead to an assertion failure in -process_immediate_pragmas. For example: - - #pragma diagnostic push - #pragma diag_suppress - int f() { int a; return a; } - #pragma diagnostic pop - -That is now fixed: The missing argument is still diagnosed, and the code after -the pragma is parsed. - - 10/5/26 [GH #195] C++-generating back end: dependent multi-dimensional subscripts @@ -107,6 +90,21 @@ C++-generating back end: inaccessible or out-of-scope template arguments In certain complex cases, the C++-generating back end could put out a template argument that uses an inaccessible or out-of-scope name, making the generated code uncompilable. This is now fixed. +10/6/26 [GH #203] +Assertion failure on an empty diag_suppress pragma + +A diag_suppress (or similar) pragma with no arguments, or with a trailing +comma, diagnosed the missing argument and then read past the end of the +directive. That, in turn, could lead to an assertion failure in +process_immediate_pragmas. For example: + + #pragma diagnostic push + #pragma diag_suppress + int f() { int a; return a; } + #pragma diagnostic pop + +That is now fixed: The missing argument is still diagnosed, and the code after +the pragma is parsed. 10/5/26 [GH #213] diff --git a/tests/tests/changes/.GH27_a.rto/edg_x86_32_cp.3.1.txt b/tests/tests/changes/.GH27_a.rto/edg_x86_32_cp.3.1.txt new file mode 100644 index 0000000000..ed724fdc2f --- /dev/null +++ b/tests/tests/changes/.GH27_a.rto/edg_x86_32_cp.3.1.txt @@ -0,0 +1,14 @@ +fe_only -DTEST_NUMBER=3 --c++11 --clang_version 230100 Test_name.c +"Test_name.c", line 14: error: incomplete type "void" is not allowed + auto v = void(); + ^ + +"Test_name.c", line 20: error: incomplete type "void" is not allowed + auto v = void(); + ^ + +"Test_name.c", line 29: error: incomplete type "Later" is not allowed + auto x = later_obj; + ^ + +3 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/GH27.sft.cpp b/tests/tests/changes/GH27.sft.cpp index 3dcc160b91..80970fbaa5 100644 --- a/tests/tests/changes/GH27.sft.cpp +++ b/tests/tests/changes/GH27.sft.cpp @@ -1,7 +1,7 @@ //type:fn //options:--c++23 //remark:[GH #27] Clearer diagnostic when auto deduces to void -// 10/6/26 [GH #27] +// 10/9/26 [GH #27] // // A plain auto deduced from void or another incomplete type gets the // incomplete-type diagnostic, matching decltype(auto). auto * still diff --git a/tests/tests/changes/GH27_a.sft.cpp b/tests/tests/changes/GH27_a.sft.cpp index cd3896ba4f..fb9d3abc76 100644 --- a/tests/tests/changes/GH27_a.sft.cpp +++ b/tests/tests/changes/GH27_a.sft.cpp @@ -1,7 +1,7 @@ //type:fn //options:--c++11 -A:--c++11 --gnu_version 160200:--c++11 --clang_version 230100:--ms_c++20 --microsoft_version 1951 //remark:[GH #27] Incomplete auto deduction in a template definition -// 10/6/26 [GH #27] +// 10/9/26 [GH #27] // // In standard and Clang modes, a plain auto deduced from an incomplete // type in a template definition gets the incomplete-type diagnostic. GCC