Re: [PATCH] c++: wrong error with variadic concept [PR105268]

2022-04-14 Thread Jason Merrill via Gcc-patches
On 4/14/22 16:24, Marek Polacek wrote: Here we issue a wrong error for the template>> void g(); line in the testcase. I surmise that's because we mistakenly parse C_many as a placeholder-type-specifier, and things go wrong from there. We are in a default argument so we should reject parsin

Re: [PATCH v2] c, c++: attribute format on a ctor with a vbase [PR101833, PR47634]

2022-04-14 Thread Jason Merrill via Gcc-patches
On 4/13/22 19:17, Marek Polacek wrote: On Tue, Apr 12, 2022 at 04:01:14PM -0400, Jason Merrill wrote: On 4/12/22 14:38, Marek Polacek wrote: On Mon, Apr 11, 2022 at 04:39:22PM -0400, Jason Merrill wrote: On 4/8/22 15:21, Marek Polacek wrote: On Wed, Apr 06, 2022 at 04:55:54PM -0400, Jason Mer

Re: [PATCH] c++: Fix up CONSTRUCTOR_PLACEHOLDER_BOUNDARY handling [PR105256]

2022-04-17 Thread Jason Merrill via Gcc-patches
On 4/15/22 07:22, Jakub Jelinek wrote: Hi! The CONSTRUCTOR_PLACEHOLDER_BOUNDARY bit is supposed to separate PLACEHOLDER_EXPRs that should be replaced by one object or subobjects of it (variable, TARGET_EXPR slot, ...) from other PLACEHOLDER_EXPRs that should be replaced by different objects or s

Re: [PATCH] c++: Fix up CONSTRUCTOR_PLACEHOLDER_BOUNDARY handling [PR105256]

2022-04-19 Thread Jason Merrill via Gcc-patches
On Tue, Apr 19, 2022, 6:53 AM Jakub Jelinek wrote: > On Mon, Apr 18, 2022 at 09:57:12AM -0400, Patrick Palka wrote: > > > Hmm, Patrick made a similar change and then reverted it for PR90996. > > > But it makes sense to me; when we replace placeholders, it's > appropriate > > > to look at the whol

Re: [PATCH] c++, coroutines: Make sure our temporaries are in a bind expr [PR105287]

2022-04-19 Thread Jason Merrill via Gcc-patches
On 4/18/22 10:02, Iain Sandoe wrote: There are a few cases where we can generate a temporary that does not need to be added to the coroutine frame (i.e. these are genuinely ephemeral). The intent was that unnamed temporaries should not be 'promoted' to coroutine frame entries. However there was

Re: [PATCH] c++, coroutines: Account for overloaded promise return_value() [PR105301].

2022-04-19 Thread Jason Merrill via Gcc-patches
On 4/18/22 10:03, Iain Sandoe wrote: Whether it was intended or not, it is possible to define a coroutine promise with multiple return_value() methods [which need not even have the same type]. We were not accounting for this possibility in the check to see whether both return_value and return_vo

Re: [PATCH] c++, coroutines: Improve check for throwing final await [PR104051].

2022-04-19 Thread Jason Merrill via Gcc-patches
On 4/18/22 11:34, Iain Sandoe wrote: We check that the final_suspend () method returns a sane type (i.e. a class or structure) but, unfortunately, that check has to be later than the one for a throwing case. If the user returns some nonsensical type from the method, we need to handle that in the

Re: [PATCH] c++, coroutines: Avoid expanding within templates [PR103868]

2022-04-19 Thread Jason Merrill via Gcc-patches
On 4/18/22 15:49, Eric Gallager via Gcc-patches wrote: On Mon, Apr 18, 2022 at 10:01 AM Iain Sandoe via Gcc-patches wrote: From: Nathan Sidwell This is a forward-port of a patch by Nathan (against 10.x) which fixes an open PR. We are ICEing because we ended up tsubst_copying something that

Re: [PATCH v2] c++: Fall through for arrays of T vs T cv [PR104996]

2022-04-21 Thread Jason Merrill via Gcc-patches
On 4/18/22 18:09, Ed Catmur wrote: If two arrays do not have the exact same element type including qualification, this could be e.g. f(int (&&)[]) vs. f(int const (&)[]), which can still be distinguished by the lvalue-rvalue tiebreaker. By tightening this branch (in accordance with the letter

Re: [PATCH] c++: wrong error with constexpr COMPOUND_EXPR [PR105321]

2022-04-21 Thread Jason Merrill via Gcc-patches
On 4/20/22 18:40, Marek Polacek wrote: Here we issue a bogus error for the first assert in the test. Therein we have = (void) (VIEW_CONVERT_EXPR(yes) || handle_error ());, VIEW_CONVERT_EXPR(value); which has a COMPOUND_EXPR, so we get to cxx_eval_constant_expression . The problem here is th

Re: [PATCH v2] c++: wrong error with constexpr COMPOUND_EXPR [PR105321]

2022-04-21 Thread Jason Merrill via Gcc-patches
Ok. On Thu, Apr 21, 2022, 9:20 AM Marek Polacek wrote: > On Thu, Apr 21, 2022 at 08:56:23AM -0400, Jason Merrill wrote: > > On 4/20/22 18:40, Marek Polacek wrote: > > > Here we issue a bogus error for the first assert in the test. Therein > > > we have > > > > > > = (void) (VIEW_CONVERT_EXPR(y

Re: [PATCH v2] c++: wrong error with constexpr COMPOUND_EXPR [PR105321]

2022-04-21 Thread Jason Merrill via Gcc-patches
Yes, also ok with that change. On Thu, Apr 21, 2022, 10:22 AM Jakub Jelinek wrote: > On Thu, Apr 21, 2022 at 09:20:48AM -0400, Marek Polacek via Gcc-patches > wrote: > > --- a/gcc/cp/constexpr.cc > > +++ b/gcc/cp/constexpr.cc > > @@ -4566,19 +4566,18 @@ cxx_eval_bit_cast (const constexpr_ctx *ct

Re: [PATCH] c++: Fix handling of temporaries with consteval ctors and non-trivial dtors [PR104055]

2022-01-18 Thread Jason Merrill via Gcc-patches
On 1/18/22 05:10, Jakub Jelinek wrote: Hi! The following testcase is miscompiled. We see the constructor is immediate, in build_over_call we trigger: if (obj_arg && is_dummy_object (obj_arg)) { call = build_cplus_new (DECL_CONTEXT (fndecl), call, complain)

Re: [PATCH] c++: Further address_compare fixes [PR89074]

2022-01-18 Thread Jason Merrill via Gcc-patches
On 1/18/22 05:17, Jakub Jelinek wrote: On Thu, Jan 13, 2022 at 04:18:33PM -0500, Jason Merrill wrote: Note, address_compare has some special cases, e.g. it assumes that static vars are never adjacent to automatic vars, which is the case for the usual layout where automatic vars are on the stack

Re: [PATCH] c++: Fix handling of temporaries with consteval ctors and non-trivial dtors [PR104055]

2022-01-18 Thread Jason Merrill via Gcc-patches
On 1/18/22 09:26, Jakub Jelinek wrote: On Tue, Jan 18, 2022 at 09:08:03AM -0500, Jason Merrill wrote: which makes call a TARGET_EXPR with the dtor in TARGET_EXPR_CLEANUP, but then call cxx_constant_value on it. In cxx_eval_outermost_constant_expr it triggers the: else if (TREE_CODE (t)

Re: [PATCH] c++: Further address_compare fixes [PR89074]

2022-01-18 Thread Jason Merrill via Gcc-patches
On 1/18/22 11:40, Jakub Jelinek wrote: On Tue, Jan 18, 2022 at 11:25:38AM -0500, Jason Merrill wrote: Can you please comment on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86369#c1 then? Done. Thanks. About the rest of the patch, I thought I had seen richi comment on IRC (but can't find t

[pushed] c++: new (nothrow) array cleanup [PR104007]

2022-01-18 Thread Jason Merrill via Gcc-patches
For this testcase, the cleanup that is supposed to happen if initialization throws was wrongly being run on the normal control path as well. This turns out to be because the EH-only handling in gimple_push_cleanup didn't apply to conditional cleanups such as we have for nothrow new, since we check

Re: [PATCH] c++: DEPENDENT_OPERATOR_TYPE as type of NTTP [PR104074]

2022-01-18 Thread Jason Merrill via Gcc-patches
On 1/18/22 11:08, Patrick Palka wrote: We're incorrectly rejecting the below testcase during template argument coercion because invalid_nontype_parm_type_p returns true for DEPENDENT_OPERATOR_TYPE. This patch fixes this by partially rewriting invalid_nontype_parm_type_p in terms of WILDCARD_TYPE

Re: [PATCH] waccess: Look at calls when tracking clobbers [PR104092]

2022-01-18 Thread Jason Merrill via Gcc-patches
On 1/18/22 13:06, Martin Sebor wrote: On 1/18/22 06:37, Richard Sandiford wrote: In this PR the waccess pass was fed:    D.10779 ={v} {CLOBBER};    VIEW_CONVERT_EXPR(D.10779) = .MASK_LOAD_LANES (addr_5(D), 64B, _2);    _7 = D.10779.__val[0]; However, the tracking of m_clobbers only looked at

[pushed] c++: input_location and lookahead [PR104025]

2022-01-18 Thread Jason Merrill via Gcc-patches
Debug information was getting confused because input_location was different depending on whether we had looked ahead to see if the next tokens look like a template argument list. I tried resetting input_location in cp_lexer_rollback_tokens itself, but that caused regressions, so let's just do it h

Re: [PATCH] c++, v2: Fix handling of temporaries with consteval ctors and non-trivial dtors [PR104055]

2022-01-18 Thread Jason Merrill via Gcc-patches
On 1/18/22 18:07, Jakub Jelinek wrote: On Tue, Jan 18, 2022 at 11:51:31AM -0500, Jason Merrill wrote: On 1/18/22 09:26, Jakub Jelinek wrote: On Tue, Jan 18, 2022 at 09:08:03AM -0500, Jason Merrill wrote: which makes call a TARGET_EXPR with the dtor in TARGET_EXPR_CLEANUP, but then call cxx_con

Re: [pushed] c++: input_location and lookahead [PR104025]

2022-01-18 Thread Jason Merrill via Gcc-patches
On 1/18/22 18:20, Jakub Jelinek wrote: On Tue, Jan 18, 2022 at 05:56:47PM -0500, Jason Merrill wrote: Debug information was getting confused because input_location was different depending on whether we had looked ahead to see if the next tokens look like a template argument list. I tried resett

Re: [PATCH] c++: non-dependent immediate member fn call [PR99895]

2022-01-19 Thread Jason Merrill via Gcc-patches
On 1/19/22 11:15, Patrick Palka wrote: Here we're emitting a bogus error during ahead of time evaluation of a non-dependent immediate member function call such as a.f(args) because the defacto templated form for such a call is (a.f)(args) but we're trying to evaluate it using the intermediate CAL

Re: [PATCH] c++: CTAD within alias template [PR91911]

2022-01-19 Thread Jason Merrill via Gcc-patches
On 1/3/22 10:24, Patrick Palka wrote: On Wed, 22 Dec 2021, Jason Merrill wrote: On 12/21/21 14:08, Patrick Palka wrote: On Tue, Dec 21, 2021 at 2:03 PM Patrick Palka wrote: On Wed, Jun 30, 2021 at 4:23 PM Jason Merrill wrote: On 6/30/21 4:18 PM, Patrick Palka wrote: On Wed, Jun 30, 2021

Re: [PATCH] c++: CTAD within alias template [PR91911]

2022-01-19 Thread Jason Merrill via Gcc-patches
On 1/19/22 17:32, Patrick Palka wrote: On Wed, 19 Jan 2022, Jason Merrill wrote: On 1/3/22 10:24, Patrick Palka wrote: On Wed, 22 Dec 2021, Jason Merrill wrote: On 12/21/21 14:08, Patrick Palka wrote: On Tue, Dec 21, 2021 at 2:03 PM Patrick Palka wrote: On Wed, Jun 30, 2021 at 4:23 PM Ja

[pushed] c++: template-id with current inst qualifier [PR102300]

2022-01-19 Thread Jason Merrill via Gcc-patches
The patch for PR41723 properly changed one place to look into the current instantiation; now we need to fix this place as well. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/102300 gcc/cp/ChangeLog: * parser.cc (cp_parser_template_name): Use dependent_scope_p. gcc/tests

Re: [PATCH] c++: ICE with noexcept and canonical types [PR101715]

2022-01-20 Thread Jason Merrill via Gcc-patches
On 1/18/22 11:05, Marek Polacek wrote: On Mon, Jan 17, 2022 at 01:48:48PM -0500, Jason Merrill wrote: On 1/14/22 19:22, Marek Polacek wrote: This is a "canonical types differ for identical types" ICE, which started with r11-4682. It's a bit tricky to explain. Consider: template struct S

[pushed] c++: designator for base class member [PR101405]

2022-01-20 Thread Jason Merrill via Gcc-patches
A C++20 designator must name a direct non-static member of the class; in this case it names a member of a base class, and we should give an error instead of crashing. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/101405 gcc/cp/ChangeLog: * decl.cc (reshape_init_class): R

Re: [PATCH v2] c++: ICE with noexcept and canonical types [PR101715]

2022-01-21 Thread Jason Merrill via Gcc-patches
On 1/20/22 20:03, Marek Polacek wrote: On Thu, Jan 20, 2022 at 03:23:24PM -0500, Jason Merrill wrote: On 1/18/22 11:05, Marek Polacek wrote: On Mon, Jan 17, 2022 at 01:48:48PM -0500, Jason Merrill wrote: On 1/14/22 19:22, Marek Polacek wrote: This is a "canonical types differ for identical ty

[pushed] c++: [[no_unique_address]] and virtual base [PR104139]

2022-01-21 Thread Jason Merrill via Gcc-patches
Fixing a thinko in my patch for 103681: when computing the size of a virtual base, it would help to use its binfo instead of the one for the derived class. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/104139 PR c++/103681 gcc/cp/ChangeLog: * class.cc (end_of_cla

Re: [PATCH v3] c++: ICE with noexcept and canonical types [PR101715]

2022-01-21 Thread Jason Merrill via Gcc-patches
On 1/21/22 12:42, Marek Polacek wrote: On Fri, Jan 21, 2022 at 09:27:17AM -0500, Jason Merrill wrote: On 1/20/22 20:03, Marek Polacek wrote: @@ -2815,12 +2816,23 @@ fixup_deferred_exception_variants (tree type, tree raises) cp_cv_quals var_quals = TYPE_QUALS (variant);

[pushed] c++: class array new checking [PR104084]

2022-01-21 Thread Jason Merrill via Gcc-patches
My patch for PR20040 made us stop exiting early from build_new_1 in cases of trivial initialization if there's a class operator delete; as a result, code later in the function needs to handle this case properly. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/104084 PR c++/2

[pushed] c++: explain failing static_assert

2022-01-21 Thread Jason Merrill via Gcc-patches
While looking at another bug I wanted the compiler to tell me what the two unequal values were. Tested x86_64-pc-linux-gnu, applying to trunk. gcc/cp/ChangeLog: * semantics.cc (find_failing_clause): Return expr if not decomposable. (finish_static_assert): Show constant va

[pushed] c++: constexpr and -fno-elide-constructors [PR101072]

2022-01-22 Thread Jason Merrill via Gcc-patches
We've been trying for a while to avoid TARGET_EXPRs in template code, but there were still a few that snuck through, and the one in this case broke the code that tried to handle it. Fixed by using IMPLICIT_CONV_EXPR, as we have done elsewhere. I also noticed that finish_compound_literal was assum

[pushed] c++: array temporary at file scope [PR104182]

2022-01-22 Thread Jason Merrill via Gcc-patches
This is the same issue as PR104031, but that patch doesn't fix this testcase because in this case, current_function_decl isn't set when we get to cp_genericize_target_expr. But there seems to be no need for is_local_temp to check for function scope; !TREE_STATIC should be enough. Tested x86_64-pc

Re: [PATCH v3] c++: designated init of char array by string constant [PR55227]

2022-01-23 Thread Jason Merrill via Gcc-patches
On 1/17/22 14:29, will wray wrote: Attached (the cut n paste looks like it removed some whitespace formatting) Pushed, thanks! I incorporated the introduction from your initial email in the commit message. Jason

Re: [PATCH] c++: value category of compound object expr [PR104173]

2022-01-23 Thread Jason Merrill via Gcc-patches
On 1/22/22 16:24, Patrick Palka wrote: Here the call to the &&-qualified toLower() is incorrectly rejected because the object expression is deemed to be an lvalue, even though it's really a prvalue. The object expression, instance()->applicationName(), is expressed as an INDIRECT_REF of a COMPOU

Re: [PATCH] c++: Fix non-portable default argument of make_auto_1 [PR104197]

2022-01-24 Thread Jason Merrill via Gcc-patches
On 1/24/22 10:27, Patrick Palka wrote: Avoid using the macro current_template_depth, which expands to an expression in terms of __FUNCTION__, within the signature of a function. Clang warns about this and MSVC rejects it. Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for t

Re: [PATCH] dwarf2out: For ppc64le IEEE quad long double, emit DW_TAG_typedef to _Float128 [PR104194]

2022-01-25 Thread Jason Merrill via Gcc-patches
On 1/25/22 06:02, Jakub Jelinek wrote: On Mon, Jan 24, 2022 at 11:26:27PM +0100, Jakub Jelinek via Gcc-patches wrote: Yet another short term solution might be not use DW_TAG_base_type for the IEEE quad long double, but instead pretend it is a DW_TAG_typedef with DW_AT_name "long double" to __flo

Re: [PATCH] c++: deleted fn and noexcept inst [PR101532, PR104225]

2022-01-25 Thread Jason Merrill via Gcc-patches
On 1/25/22 12:33, Patrick Palka wrote: On Tue, 25 Jan 2022, Patrick Palka wrote: Here when attempting to use B's implicitly deleted default constructor, mark_used rightfully returns false, but for the wrong reason: it tries to instantiate the implicit noexcept specifier, which only silently fai

[pushed] c++: assignment to temporary [PR59950]

2022-01-25 Thread Jason Merrill via Gcc-patches
Given build_this of a TARGET_EXPR, cp_build_fold_indirect_ref returns the TARGET_EXPR. But that's the wrong value category for the result of the defaulted class assignment operator, which returns an lvalue, so we need to actually build the INDIRECT_REF. Tested x86_64-pc-linux-gnu, applying to tru

[pushed] c++: alias template and typename [PR103057]

2022-01-25 Thread Jason Merrill via Gcc-patches
Usually we handle DR1558 substitution near the top of tsubst, but in this case while substituting TYPENAME_TYPE we were passing an alias specialization to tsubst_aggr_type, which ignored its aliasness. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/103057 gcc/cp/ChangeLog:

Re: [PATCH] c++: Fix up handling of vector CONSTRUCTORs with vectors in it in constexpr.cc [PR104226]

2022-01-26 Thread Jason Merrill via Gcc-patches
On 1/26/22 04:33, Jakub Jelinek wrote: Hi! The middle-end uses sometimes VECTOR_TYPE CONSTRUCTORs that contain some other VECTOR_TYPE elements in it (should be with compatible element size and smaller number of elements, e.g. a V8SImode vector can be constructed as { V4SImode_var_1, V4SImode_var

Re: [PATCH] warn-access: Prevent -Wuse-after-free on ARM [PR104213]

2022-01-26 Thread Jason Merrill via Gcc-patches
On 1/25/22 18:33, Marek Polacek wrote: Here, -Wuse-after-free warns about using 'this' which, on ARM, cdtors return, as mandated by the EABI. To be entirely correct, it only requires it for C1 and C2 ctors and D2 and D1 dtors, but I don't feel like changing that now and possibly running into iss

[pushed] c++: ->template and using-decl [PR104235]

2022-01-26 Thread Jason Merrill via Gcc-patches
cp_parser_template_id wasn't prepared to handle getting a USING_DECL back from cp_parser_template_name. Let's defer that case to instantiation time, as well. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/104235 gcc/cp/ChangeLog: * parser.cc (cp_parser_template_name): Re

[pushed] c++: vector compound literal [PR104206]

2022-01-26 Thread Jason Merrill via Gcc-patches
My patch for PR101072 removed the specific VECTOR_TYPE handling here, which broke pr72747-2.c on PPC; this patch restores it. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/104206 PR c++/101072 gcc/cp/ChangeLog: * semantics.cc (finish_compound_literal): Restore VE

[PATCH RFA (tree)] c++: lambda in template default argument [PR103186]

2022-01-26 Thread Jason Merrill via Gcc-patches
The problem with this testcase was that since my patch for PR97900 we weren't preserving DECL_UID identity for parameters of instantiations of templated functions, so using those parameters as the keys for the defarg_inst map broke. I think this was always fragile given the possibility of redeclar

Re: [PATCH] c++: new-expr of array of deduced class tmpl [PR101988]

2022-01-26 Thread Jason Merrill via Gcc-patches
On 1/26/22 18:55, Marek Polacek wrote: In r12-1933 I attempted to implement DR2397 aka allowing int a[3]; auto (&r)[3] = a; by removing the type_uses_auto check in create_array_type_for_decl. That may have gone too far, because it also allows arrays of CLASS_PLACEHOLDER_TEMPLATE and it lo

Re: [PATCH] c++: non-dependent immediate member fn call [PR99895]

2022-01-27 Thread Jason Merrill via Gcc-patches
On 1/27/22 09:02, Patrick Palka wrote: On Wed, 26 Jan 2022, Patrick Palka wrote: On Wed, 26 Jan 2022, Patrick Palka wrote: On Wed, Jan 19, 2022 at 2:19 PM Jason Merrill wrote: On 1/19/22 11:15, Patrick Palka wrote: Here we're emitting a bogus error during ahead of time evaluation of a non

Re: [PATCH] c++: constrained partial spec using qualified name [PR92944]

2022-01-27 Thread Jason Merrill via Gcc-patches
On 1/26/22 12:49, Patrick Palka wrote: In the nested_name_specifier branch within cp_parser_class_head, we need to update TYPE with the result of maybe_process_partial_specialization just like we do in the template_id_p branch. Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK

[pushed] c++: dependent and non-dependent attributes [PR104245]

2022-01-27 Thread Jason Merrill via Gcc-patches
A flaw in my patch for PR51344 was that cplus_decl_attributes calls decl_attributes after save_template_attributes, which messes up the ordering that save_template_attributes set up. Fixed by splitting save_template_attributes around the call to decl_attributes. Tested x86_64-pc-linux-gnu, applyi

Re: [PATCH] c++: var tmpl w/ dependent constrained auto type [PR103341]

2022-01-27 Thread Jason Merrill via Gcc-patches
On 1/27/22 13:06, Patrick Palka wrote: On Thu, 27 Jan 2022, Patrick Palka wrote: When deducing the type of a variable template specialization with a constrained auto type, we might need the template arguments for satisfaction in case the constraint is dependent. It looks like templated static

Re: [PATCH] c++: ICE with auto[] and VLA [PR102414]

2022-01-27 Thread Jason Merrill via Gcc-patches
On 1/27/22 20:02, Marek Polacek wrote: Here we ICE in unify_array_domain when we're trying to deduce the type of an array, as in auto(*p)[i] = (int(*)[i])0; but unify_array_domain doesn't arbitrarily complex bounds. Another test is, e.g., auto (*b)[0/0] = &a; where the type of the arra

[pushed] c++: pack in enumerator in lambda [PR100198]

2022-01-27 Thread Jason Merrill via Gcc-patches
The GCC 8 lambda overhaul fixed most uses of lambdas in pack expansions, but local enums and classes within such lambdas that depend on parameter packs are still broken. For now, give a sorry instead of an ICE or incorrect error. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/1001

Re: [PATCH] c++: bogus warning with value init of const pmf [PR92752]

2022-01-28 Thread Jason Merrill via Gcc-patches
On 1/28/22 12:54, Patrick Palka wrote: Here we're emitting a -Wignored-qualifiers warning for an intermediate compiler-generated cast of 0 to 'method-type* const' as part of value initialization of a const pmf. This patch suppresses the warning by stripping cv-quals from this pointer type before

Re: [PATCH] c++: CONSTRUCTORs are non-deduced contexts [PR104291]

2022-01-31 Thread Jason Merrill via Gcc-patches
On 1/31/22 12:27, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? PR c++/104291 gcc/cp/ChangeLog: * pt.cc (for_each_template_parm_r) : Don't walk subtrees if !include_nondeduced_p. Simplify given that cp_walk

Re: [PATCH v2] c++: ICE with auto[] and VLA [PR102414]

2022-01-31 Thread Jason Merrill via Gcc-patches
On 1/28/22 15:49, Marek Polacek wrote: On Thu, Jan 27, 2022 at 10:17:00PM -0500, Jason Merrill wrote: On 1/27/22 20:02, Marek Polacek wrote: @@ -11159,8 +11159,16 @@ create_array_type_for_decl (tree name, tree type, tree size, location_t loc) /* Figure out the index type for the array. *

Re: [PATCH] c++: Reject union std::initializer_list [PR102434]

2022-01-31 Thread Jason Merrill via Gcc-patches
On 1/28/22 20:21, Marek Polacek wrote: Weird things are going to happen if you define your std::initializer_list as a union. In this case, we crash in output_constructor_regular_field. Let's not allow such a definition in the first place. Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for t

Re: [PATCH] c++: CTAD for class tmpl defined inside partial spec [PR104294]

2022-01-31 Thread Jason Merrill via Gcc-patches
On 1/31/22 11:14, Patrick Palka wrote: On Mon, Jan 31, 2022 at 11:07 AM Patrick Palka wrote: Here during deduction guide generation for the nested class template B::C, the computation of outer_targs yields the template arguments relative to the primary template for B (i.e. {char(int)}) but wha

PING Re: [PATCH RFA (tree)] c++: lambda in template default argument [PR103186]

2022-01-31 Thread Jason Merrill via Gcc-patches
Ping. On 1/26/22 18:16, Jason Merrill wrote: The problem with this testcase was that since my patch for PR97900 we weren't preserving DECL_UID identity for parameters of instantiations of templated functions, so using those parameters as the keys for the defarg_inst map broke. I think this was

Re: [PATCH] libcpp: Fix up padding handling in funlike_invocation_p [PR104147]

2022-01-31 Thread Jason Merrill via Gcc-patches
On 1/31/22 14:03, Jakub Jelinek wrote: Hi! As mentioned in the PR, in some cases we preprocess incorrectly when we encounter an identifier which is defined as function-like macro, followed by at least 2 CPP_PADDING tokens and then some other identifier. On the following testcase, the problem is

Re: [PATCH] libcpp: Avoid PREV_WHITE and other random content on CPP_PADDING tokens

2022-02-01 Thread Jason Merrill via Gcc-patches
On 2/1/22 10:31, Jakub Jelinek wrote: On Tue, Feb 01, 2022 at 10:03:57AM +0100, Jakub Jelinek via Gcc-patches wrote: I wonder if we shouldn't replace that toks[0] = pfile->directive_result; line with toks[0] = pfile->avoid_paste; or even replace those toks = XNEW (cpp_token)

Re: [PATCH] c++: lambda in pack expansion using outer pack in constraint [PR103706]

2022-02-02 Thread Jason Merrill via Gcc-patches
On 2/2/22 12:09, Patrick Palka wrote: The satisfaction cache needs to look through ARGUMENT_PACK_SELECT template arguments before calling iterative_hash_template_arg and template_args_equal, which would otherwise crash. Maybe we should handle ARGUMENT_PACK_SELECT in iterative_hash_template_arg

Re: [PATCH] c++: constrained auto in lambda using outer tparms [PR103706]

2022-02-02 Thread Jason Merrill via Gcc-patches
On 2/2/22 13:21, Patrick Palka wrote: On Wed, 2 Feb 2022, Patrick Palka wrote: Here we're crashing during satisfaction of the lambda's placeholder type constraints because the constraints depend on the template arguments from the enclosing scope, which aren't a part of the lambda's DECL_TI_ARGS

[PATCH] c++: dependent array bounds completion [PR104302]

2022-02-02 Thread Jason Merrill via Gcc-patches
The patch for PR55227 changed the minimal init-list handling in cp_complete_array_type to a call to reshape_init, which broke on the dependent initializer. It occurred to me that trying to deduce the array size from a dependent init-list is wrong in general, as we can see with the second testcase,

Re: [PATCH] debug/104337 - avoid messing with the abstract origin chain in NRV

2022-02-03 Thread Jason Merrill via Gcc-patches
On 2/3/22 05:27, Richard Biener wrote: The following avoids NRV from massaging DECL_ABSTRACT_ORIGIN after variable creation since NRV runs _after_ the function was inlined and thus affects the inlined variables copy indirectly. We may adjust the abstract origin of a variable only at the point we

Re: [PATCH v2] constrain conservative string lengths to array sizes [PR104119]

2022-02-03 Thread Jason Merrill via Gcc-patches
On 1/20/22 17:54, Martin Sebor wrote: The updated patch ensures the tighter bound isn't used to compute the sprintf result and adds a test to verify that.  (This is messy in the strlen/sprintf pass and should be cleaned up to avoid this mistake in the future.) Rested on x86_64-linux. OK, thank

Re: [PATCH] c++, v2: Further address_compare fixes [PR89074]

2022-02-03 Thread Jason Merrill via Gcc-patches
On 2/3/22 10:52, Jakub Jelinek wrote: On Tue, Jan 18, 2022 at 05:40:48PM +0100, Jakub Jelinek via Gcc-patches wrote: About the rest of the patch, I thought I had seen richi comment on IRC (but can't find the comment now) that these cases where we could give a constant answer but decide not to be

Re: [PATCH] c++: dependence of member's noexcept-spec [PR104079]

2022-02-03 Thread Jason Merrill via Gcc-patches
On 2/3/22 11:49, Patrick Palka wrote: Here a stale value of TYPE_DEPENDENT_P/_P_VALID for f's function type after replacing its DEFERRED_NOEXCEPT with its parsed (dependent) noexcept-spec leads us to try to instantiate g's noexcept-spec (which incorrectly appears non-dependent) ahead of time, cau

Re: [PATCH] c++: lambda in pack expansion using outer pack in constraint [PR103706]

2022-02-03 Thread Jason Merrill via Gcc-patches
On 2/3/22 12:04, Patrick Palka wrote: On Wed, 2 Feb 2022, Jason Merrill wrote: On 2/2/22 12:09, Patrick Palka wrote: The satisfaction cache needs to look through ARGUMENT_PACK_SELECT template arguments before calling iterative_hash_template_arg and template_args_equal, which would otherwise cr

Re: [PATCH] c++: conditional noexcept-spec on defaulted comparison op [PR96242]

2022-02-03 Thread Jason Merrill via Gcc-patches
On 2/3/22 14:58, Patrick Palka wrote: When synthesizing a defaulted comparison op from maybe_instantiate_noexcept, we seem to be forgetting to instantiate the noexcept-spec afterwards. Hmm, there shouldn't be any need to instantiate the noexcept-spec afterwards, it should have been set by ~com

Re: [PATCH] c++, v2: Further address_compare fixes [PR89074]

2022-02-03 Thread Jason Merrill via Gcc-patches
On 2/3/22 15:33, Jakub Jelinek wrote: On Thu, Feb 03, 2022 at 03:07:03PM -0500, Jason Merrill wrote: --- gcc/fold-const.h.jj 2022-02-01 20:10:51.235856007 +0100 +++ gcc/fold-const.h2022-02-03 15:02:02.700228631 +0100 -/* Non-zero if we are folding constants inside an initializer; zero - ot

Re: [PATCH] c++: lambda in pack expansion using outer pack in constraint [PR103706]

2022-02-03 Thread Jason Merrill via Gcc-patches
On 2/3/22 15:55, Patrick Palka wrote: On Thu, Feb 3, 2022 at 3:20 PM Jason Merrill wrote: On 2/3/22 12:04, Patrick Palka wrote: On Wed, 2 Feb 2022, Jason Merrill wrote: On 2/2/22 12:09, Patrick Palka wrote: The satisfaction cache needs to look through ARGUMENT_PACK_SELECT template argument

Re: [PATCH] c++, v2: Further address_compare fixes [PR89074]

2022-02-03 Thread Jason Merrill via Gcc-patches
On 2/3/22 16:18, Jakub Jelinek wrote: On Thu, Feb 03, 2022 at 04:04:57PM -0500, Jason Merrill wrote: I think it would be clearer to leave the !DECL_P case alone and add /* In C++ it is unspecified, and so non-constant, whether two equivalent strings have the same address. */ else if (fold

Re: [PATCH] c++: conditional noexcept-spec on defaulted comparison op [PR96242]

2022-02-03 Thread Jason Merrill via Gcc-patches
On 2/3/22 16:06, Patrick Palka wrote: On Thu, 3 Feb 2022, Jason Merrill wrote: On 2/3/22 14:58, Patrick Palka wrote: When synthesizing a defaulted comparison op from maybe_instantiate_noexcept, we seem to be forgetting to instantiate the noexcept-spec afterwards. Hmm, there shouldn't be any

Re: [PATCH] c++, v3: Further address_compare fixes [PR89074]

2022-02-04 Thread Jason Merrill via Gcc-patches
On 2/4/22 08:41, Jakub Jelinek wrote: On Thu, Feb 03, 2022 at 04:34:17PM -0500, Jason Merrill wrote: On 2/3/22 16:18, Jakub Jelinek wrote: On Thu, Feb 03, 2022 at 04:04:57PM -0500, Jason Merrill wrote: I think it would be clearer to leave the !DECL_P case alone and add /* In C++ it is unspeci

Re: [PATCH] c++: Improve diagnostics for template args terminated with >= or >>= [PR104319]

2022-02-04 Thread Jason Merrill via Gcc-patches
On 2/4/22 09:12, Jakub Jelinek wrote: Hi! As mentioned in the PR, for C++98 we have diagnostics that expect terminating template arguments to be a mistake for > > (C++11 said it has to be treated that way), while if user trying to spare the spacebar doesn't separate > from following = or >> fr

Re: [PATCH] c++: conditional noexcept-spec on defaulted comparison op [PR96242]

2022-02-04 Thread Jason Merrill via Gcc-patches
On 2/4/22 12:04, Patrick Palka wrote: On Thu, 3 Feb 2022, Jason Merrill wrote: On 2/3/22 16:06, Patrick Palka wrote: On Thu, 3 Feb 2022, Jason Merrill wrote: On 2/3/22 14:58, Patrick Palka wrote: When synthesizing a defaulted comparison op from maybe_instantiate_noexcept, we seem to be forg

Re: [PATCH] c++: Improve diagnostics for template args terminated with >= or >>= [PR104319]

2022-02-04 Thread Jason Merrill via Gcc-patches
On 2/4/22 17:10, Jakub Jelinek wrote: On Fri, Feb 04, 2022 at 04:54:39PM -0500, Jason Merrill wrote: Bootstrapped/regtested on powerpc64le-linux, ok for trunk? Or shall it wait for GCC 13? Hmm, I lean toward GCC 13; this seems more of a stage 3 change. Ok. I see you test valid uses of >= i

[pushed] c++: assignment, aggregate, array [PR104300]

2022-02-04 Thread Jason Merrill via Gcc-patches
The PR92385 fix meant that we see more VEC_INIT_EXPR outside of INIT_EXPR; in such cases, we need to wrap them in TARGET_EXPR. I previously fixed that in build_array_copy; we also need it in process_init_constructor. After fixing that, I needed to adjust a few places to recognize the VEC_INIT_EXPR

Re: [PATCH] c++, v4: Further address_compare fixes [PR89074]

2022-02-05 Thread Jason Merrill via Gcc-patches
On 2/5/22 07:17, Jakub Jelinek wrote: On Sat, Feb 05, 2022 at 12:02:14AM +0100, Jakub Jelinek via Gcc-patches wrote: You mean for folding_cxx_constexpr ? The code does that basically, with one exception, the folding_initializer FUNCTION_DECL cmp FUNCTION_DECL case. We don't track sizes of funct

Re: [PATCH] c++: lambda in pack expansion using outer pack in constraint [PR103706]

2022-02-07 Thread Jason Merrill via Gcc-patches
On 2/7/22 12:34, Patrick Palka wrote: On Thu, 3 Feb 2022, Jason Merrill wrote: On 2/3/22 15:55, Patrick Palka wrote: On Thu, Feb 3, 2022 at 3:20 PM Jason Merrill wrote: On 2/3/22 12:04, Patrick Palka wrote: On Wed, 2 Feb 2022, Jason Merrill wrote: On 2/2/22 12:09, Patrick Palka wrote: T

Re: [PATCH] c++: deducing only from noexcept-spec [PR80951]

2022-02-07 Thread Jason Merrill via Gcc-patches
On 2/7/22 09:57, Patrick Palka wrote: The fail-fast predicate uses_deducible_template_parms used by unify_one_argument is neglecting to look inside the noexcept-spec of a function type, and this causes deduction to fail for the below testcase since the noexcept-spec is the only part of the type w

Re: [PATCH] c++: satisfaction value of type const bool [PR104410]

2022-02-07 Thread Jason Merrill via Gcc-patches
On 2/7/22 09:57, Patrick Palka wrote: Here constant evaluation of the atomic constraint use_func_v with T=int sensibly yields an INTEGER_CST of type const bool, but the assert in satisfaction_value expects unqualified bool. Let's just relax the assert to accept cv-qualified bool more generally.

Re: [PATCH] c++: Remove superflous assert [PR104403]

2022-02-08 Thread Jason Merrill via Gcc-patches
On 2/8/22 03:16, Jakub Jelinek wrote: Hi! I've added the assert because start_decl diagnoses such vars for C++20 and earlier: if (current_function_decl && VAR_P (decl) && DECL_DECLARED_CONSTEXPR_P (current_function_decl) && cxx_dialect < cxx23) but as can be seen, we cam trigger

Re: [PATCH] c++: Don't emit repeated -Wshadow warnings for templates/ctors [PR104379]

2022-02-08 Thread Jason Merrill via Gcc-patches
On 2/8/22 03:22, Jakub Jelinek wrote: Hi! The following patch suppresses extraneous -Wshadow warnings. On the testcase without the patch we emit 14 -Wshadow warnings, with the patch just 4. It is enough to warn once e.g. during parsing of the template or the abstract ctor, while previously we'd

Re: [PATCH] dwarf2out: Don't call expand_expr during early_dwarf [PR104407]

2022-02-08 Thread Jason Merrill via Gcc-patches
On 2/8/22 03:35, Richard Biener wrote: On Tue, 8 Feb 2022, Jakub Jelinek wrote: Hi! As mentioned in the PR, since PR96690 r11-2834 we call rtl_for_decl_init which can call expand_expr already during early_dwarf. The comment and PR explains it that the intent is to ensure the referenced vars a

Re: [PATCH] Fix PR 101515 (ICE in pp_cxx_unqualified_id, at cp/cxx-pretty-print.c:128)

2022-02-08 Thread Jason Merrill via Gcc-patches
On 2/8/22 15:11, Qing Zhao wrote: Hi, This is the patch to fix PR101515 (ICE in pp_cxx_unqualified_id, at cp/cxx-pretty-print.c:128) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101515 It's possible that the TYPE_NAME of a record_type is NULL, therefore when printing the TYPE_NAME, we should

Re: [PATCH] handle "invisible" reference in -Wdangling-pointer (PR104436)

2022-02-08 Thread Jason Merrill via Gcc-patches
On 2/8/22 16:59, Martin Sebor wrote: Transforming a by-value arguments to by-reference as GCC does for some class types can trigger -Wdangling-pointer when the argument is used to store the address of a local variable.  Since the stored value is not accessible in the caller the warning is a false

[pushed] c++: cleanup constant-init'd members [PR96876]

2022-02-08 Thread Jason Merrill via Gcc-patches
This is a case missed by my recent fixes to aggregate initialization and exception cleanup for PR94041 et al: we also need to clean up members with constant initialization if initialization of a later member throws. It also occurs to me that we needn't bother building the cleanups if -fno-exceptio

[pushed] c++: P2493 feature test macro updates

2022-02-09 Thread Jason Merrill via Gcc-patches
The C++ committee just updated the values of these macros to reflect some late C++20 papers that we implement but others don't yet; see PR103891. Tested x86_64-pc-linux-gnu, applying to trunk. gcc/c-family/ChangeLog: * c-cppbuiltin.cc (c_cpp_builtins): Update values of __cpp_cons

Re: [PATCH] handle "invisible" reference in -Wdangling-pointer (PR104436)

2022-02-09 Thread Jason Merrill via Gcc-patches
On 2/9/22 03:30, Richard Biener wrote: On Tue, Feb 8, 2022 at 11:38 PM Jason Merrill via Gcc-patches wrote: On 2/8/22 16:59, Martin Sebor wrote: Transforming a by-value arguments to by-reference as GCC does for some class types can trigger -Wdangling-pointer when the argument is used to

[pushed] c++: modules and explicit(bool) [PR103752]

2022-02-09 Thread Jason Merrill via Gcc-patches
We weren't streaming a C++20 dependent explicit-specifier. gcc/cp/ChangeLog: * module.cc (trees_out::core_vals): Stream explicit specifier. (trees_in::core_vals): Likewise. * pt.cc (store_explicit_specifier): No longer static. (tsubst_function_decl): Clear DECL_HAS

Re: [PATCH] c++: memfn lookup consistency and using-decls [PR104432]

2022-02-09 Thread Jason Merrill via Gcc-patches
On 2/9/22 10:45, Patrick Palka wrote: In filter_memfn_lookup, we weren't correctly recognizing and matching up member functions introduced via a non-dependent using-decl. This caused us to crash in the below testcases in which we correctly pruned the overload set for the non-dependent call ahead

Re: [PATCH] c++: memfn lookup consistency and using-decls [PR104432]

2022-02-09 Thread Jason Merrill via Gcc-patches
On 2/9/22 11:36, Patrick Palka wrote: On Wed, 9 Feb 2022, Jason Merrill wrote: On 2/9/22 10:45, Patrick Palka wrote: In filter_memfn_lookup, we weren't correctly recognizing and matching up member functions introduced via a non-dependent using-decl. This caused us to crash in the below testca

Re: [PATCH] Fix PR 101515 (ICE in pp_cxx_unqualified_id, at cp/cxx-pretty-print.c:128)

2022-02-09 Thread Jason Merrill via Gcc-patches
On 2/9/22 10:51, Qing Zhao wrote: On Feb 8, 2022, at 4:20 PM, Jason Merrill wrote: On 2/8/22 15:11, Qing Zhao wrote: Hi, This is the patch to fix PR101515 (ICE in pp_cxx_unqualified_id, at cp/cxx-pretty-print.c:128) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101515 It's possible that th

Re: [PATCH] Fix PR 101515 (ICE in pp_cxx_unqualified_id, at cp/cxx-pretty-print.c:128)

2022-02-09 Thread Jason Merrill via Gcc-patches
On 2/9/22 16:01, Qing Zhao wrote: On Feb 9, 2022, at 12:23 PM, Jason Merrill wrote: On 2/9/22 10:51, Qing Zhao wrote: On Feb 8, 2022, at 4:20 PM, Jason Merrill wrote: On 2/8/22 15:11, Qing Zhao wrote: Hi, This is the patch to fix PR101515 (ICE in pp_cxx_unqualified_id, at cp/cxx-pretty

Re: [PATCH] c++: memfn lookup consistency and using-decls [PR104432]

2022-02-09 Thread Jason Merrill via Gcc-patches
On 2/9/22 15:15, Patrick Palka wrote: On Wed, 9 Feb 2022, Jason Merrill wrote: On 2/9/22 11:36, Patrick Palka wrote: On Wed, 9 Feb 2022, Jason Merrill wrote: On 2/9/22 10:45, Patrick Palka wrote: In filter_memfn_lookup, we weren't correctly recognizing and matching up member functions intro

Re: [PATCH] c: Add diagnostic when operator= is used as truth cond [PR25689]

2022-02-10 Thread Jason Merrill via Gcc-patches
On 2/9/22 21:18, Zhao Wei Liew via Gcc-patches wrote: Hi! I wrote a patch for PR 25689, but I feel like it may not be the ideal fix. Furthermore, there are some standing issues with the patch for which I would like tips on how to fix them. Specifically, there are 2 issues: 1. GCC warns about if

[pushed] c++: ICE on xtreme-header_a.H

2022-02-10 Thread Jason Merrill via Gcc-patches
This test regressed after my PR103752 patch with -march=cascadelake. I don't understand why that flag makes a difference, but this patch is correct in any case. Tested x86_64-pc-linux-gnu, applying to trunk. gcc/cp/ChangeLog: * module.cc (depset::hash::add_specializations): Use

<    4   5   6   7   8   9   10   11   12   13   >