diff --git a/src/Changes b/src/Changes index ef7a906913..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 diff --git a/src/overload.c b/src/overload.c index 4eafe2f719..57d3973e66 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 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; @@ -4399,7 +4405,8 @@ it is always NULL. 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. */ @@ -4621,7 +4628,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 +4783,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 @@ -31235,10 +31244,19 @@ 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. */ + /* 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 = + !((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, - (a_boolean *)NULL)) { + (a_boolean *)NULL, + 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/changes/.GH27.rto/default.1.1.txt b/tests/tests/changes/.GH27.rto/default.1.1.txt new file mode 100644 index 0000000000..a070370061 --- /dev/null +++ b/tests/tests/changes/.GH27.rto/default.1.1.txt @@ -0,0 +1,30 @@ +fe_only -DTEST_NUMBER=1 --c++23 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_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_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 new file mode 100644 index 0000000000..80970fbaa5 --- /dev/null +++ b/tests/tests/changes/GH27.sft.cpp @@ -0,0 +1,36 @@ +//type:fn +//options:--c++23 +//remark:[GH #27] Clearer diagnostic when auto deduces to void +// 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 +// fails deduction. + +struct Incomplete; + +struct Incomplete &getIncomplete(); + +struct Clap { + template + auto parse(this Spec const& spec) { + } +}; + +struct Args : Clap { +}; + +void g(); + +void f() +{ + auto v1 = void(); + decltype(auto) v2 = void(); + auto v3 = getIncomplete(); + auto opts = Args{}.parse(); + + auto *v4 = void(); + auto *v5 = 1; + auto *p = g(); +} + diff --git a/tests/tests/changes/GH27_a.sft.cpp b/tests/tests/changes/GH27_a.sft.cpp new file mode 100644 index 0000000000..fb9d3abc76 --- /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/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 +// 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>(); +} 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/.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/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". 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".