Re: [PATCH] c++: Fix folding of non-dependent BASELINKs [PR95468]

2021-02-22 Thread Jason Merrill via Gcc-patches
On 2/13/21 10:21 PM, Patrick Palka wrote: On Fri, 12 Feb 2021, Patrick Palka wrote: Here, the problem ultimately seems to be that tsubst_copy_and_build, when called with empty args as we do during non-dependent expression folding, doesn't touch BASELINKs at all: it delegates to tsubst_copy whic

Re: [PATCH, constexpr, coroutines ] Generic lambda coroutines cannot be constexpr [PR96251].

2021-02-23 Thread Jason Merrill via Gcc-patches
On 2/23/21 8:20 AM, Iain Sandoe wrote: Hi Jason, Jason Merrill wrote: On 2/22/21 3:59 PM, Iain Sandoe wrote: * I was not able to see any way in which the instantiation process could be made to bail in this case and re-try for non-constexpr. Many of the other places that set cp_functio

Re: PING [PATCH] avoid -Warray-bounds checks for vtable assignments (PR 98266)

2021-02-23 Thread Jason Merrill via Gcc-patches
On 2/23/21 11:02 AM, Martin Sebor wrote: [CC Jason for any further comments/clarification] On 2/9/21 10:49 AM, Martin Sebor wrote: On 2/8/21 4:11 PM, Jeff Law wrote: On 2/8/21 3:44 PM, Martin Sebor wrote: On 2/8/21 3:26 PM, Jeff Law wrote: On 2/8/21 2:56 PM, Martin Sebor wrote: On 2/8/2

Re: [PATCH RFA] cgraph: flatten and same_body aliases [PR96078]

2021-02-24 Thread Jason Merrill via Gcc-patches
On 2/16/21 1:52 PM, Jeff Law wrote: On 2/11/21 10:18 PM, Jason Merrill via Gcc-patches wrote: The patch for PR92372 made us start warning about a flatten attribute on an alias. But in the case of C++ 'tor base/complete variants, the user didn't create the alias, so we shouldn&

Re: PING [PATCH] avoid -Warray-bounds checks for vtable assignments (PR 98266)

2021-02-24 Thread Jason Merrill via Gcc-patches
On 2/23/21 6:07 PM, Martin Sebor wrote: On 2/23/21 2:52 PM, Jason Merrill wrote: On 2/23/21 11:02 AM, Martin Sebor wrote: [CC Jason for any further comments/clarification] On 2/9/21 10:49 AM, Martin Sebor wrote: On 2/8/21 4:11 PM, Jeff Law wrote: On 2/8/21 3:44 PM, Martin Sebor wrote: On

Re: [PATCH] avoid -Wnonull for dynamic_cast (PR 99251)

2021-02-24 Thread Jason Merrill via Gcc-patches
On 2/24/21 5:25 PM, Martin Sebor wrote: In r11-6900 (PR 98646 - static_cast confuses -Wnonnull) we decided that issuing -Wnonnull for dereferencing the result of dynamic_cast was helpful despite the false positives it causes when the pointer is guaranteed not to be null because of a prior test.

Re: [PATCH] c++: const_cast of null pointer in constant expr [PR99176]

2021-02-24 Thread Jason Merrill via Gcc-patches
On 2/24/21 5:34 PM, Marek Polacek wrote: Here we reject constexpr const int *p = nullptr; constexpr int *q = const_cast(p); with "conversion of 'const int*' null pointer to 'int*' is not a constant expression", which seems bogus. This code has been rejected since r238909 which added the

Re: [PATCH] c++: Private parent access check for using decls [PR19377]

2021-02-24 Thread Jason Merrill via Gcc-patches
On 2/24/21 4:17 PM, Anthony Sharp wrote: "special" It wouldn't be my code if it didn't have sp3ling mstakes innit! Actually to be fair I already changed that spelling mistake a few days ago in my local code ;) I was actually thinking about this last night as I was falling asleep (as you do) a

Re: [PATCH] c++: Fix pretty printing of context of local class [PR99213]

2021-02-25 Thread Jason Merrill via Gcc-patches
On 2/25/21 1:37 AM, Patrick Palka wrote: My r10-7705 patch for PR94521 made us set TFF_NO_FUNCTION_ARGUMENTS when pretty printing the function scope of a local class type in order to eliminate infinite recursion with a function signature that contains decltype([]{}). But due to the way dump_func

Re: [PATCH] c++: Fix call to push_tinst_level during satisfaction [PR99214]

2021-02-25 Thread Jason Merrill via Gcc-patches
On 2/25/21 1:37 AM, Patrick Palka wrote: In-Reply-To: <20210225063712.3725111-1-ppa...@redhat.com> BTW, This patch doesn't seem in any way a reply to your previous patch, so it's confusing for the mail headers (and thus MUA threading) to say that it is. Maybe you want git send-email --no-thr

Re: [PATCH] c++: ICE with deduction guide in checking type-dep [PR99009, PR97034]

2021-02-25 Thread Jason Merrill via Gcc-patches
On 2/12/21 6:12 PM, Marek Polacek wrote: We represent deduction guides with FUNCTION_DECLs, but they are built without DECL_CONTEXT Hmm, that seems wrong: "A deduction-guide shall be declared in the same scope as the corresponding class template and, for a member class template, with the same

Re: [PATCH] c++: Fix CTAD from single-element initializer list [PR99103]

2021-02-25 Thread Jason Merrill via Gcc-patches
On 2/15/21 2:30 PM, Patrick Palka wrote: When determining whether to rule out initializer-list constructors during CTAD with a single-element initializer list, the element type's cv-qualifiers should be irrelevant. This patch fixes this by making is_spec_or_derived strip cv-qualifiers from the s

Re: [PATCH] coroutines : Remove throwing_cleanup marks from the ramp [PR95822].

2021-02-25 Thread Jason Merrill via Gcc-patches
On 2/24/21 3:06 PM, Iain Sandoe wrote: Hi, The FE contains a mechanism for cleaning up return expressions if a function throws during the execution of cleanups prior to the return. If the original function has a return value with a non-trivial DTOR and the body contains a var with a DTOR that m

Re: [PATCH] c++: Fix operator() lookup in lambdas [PR95451]

2021-02-25 Thread Jason Merrill via Gcc-patches
On 2/25/21 1:48 PM, Jakub Jelinek wrote: Hi! During name lookup, name-lookup.c uses: if (!(!iter->type && HIDDEN_TYPE_BINDING_P (iter)) && (bool (want & LOOK_want::HIDDEN_LAMBDA) || !is_lambda_ignored_entity (iter->value)) && qu

Re: [PATCH] c++: Implement P1102R2 - Down with ()!

2021-02-25 Thread Jason Merrill via Gcc-patches
On 2/25/21 1:44 PM, Jakub Jelinek wrote: Hi! The following patch implements P1102R2. For attributes, we have already attribute parsing before the parameter declarations and so when that is omitted, if the attributes are first we already accept it. Bootstrapped/regtested on x86_64-linux and i686

Re: [PATCH v2] c++: const_cast of null pointer in constant expr [PR99176]

2021-02-25 Thread Jason Merrill via Gcc-patches
On 2/25/21 4:20 PM, Marek Polacek wrote: On Wed, Feb 24, 2021 at 10:32:59PM -0500, Jason Merrill wrote: On 2/24/21 5:34 PM, Marek Polacek wrote: Here we reject constexpr const int *p = nullptr; constexpr int *q = const_cast(p); with "conversion of 'const int*' null pointer to 'int*' i

Re: [PATCH] c++: abbreviated function template return type rewriting [PR98990]

2021-02-25 Thread Jason Merrill via Gcc-patches
On 2/25/21 5:09 PM, Patrick Palka wrote: On Tue, 9 Feb 2021, Patrick Palka wrote: When an abbreviated function template has a complex placeholder return type such auto& or auto**, the level adjustment performed by splice_late_return_type directly replaces the 'auto' inside the original return t

Re: [PATCH] c++: ICE with deduction guide in checking type-dep [PR99009, PR97034]

2021-02-25 Thread Jason Merrill via Gcc-patches
On 2/25/21 5:41 PM, Marek Polacek wrote: On Thu, Feb 25, 2021 at 10:59:49AM -0500, Jason Merrill wrote: On 2/12/21 6:12 PM, Marek Polacek wrote: We represent deduction guides with FUNCTION_DECLs, but they are built without DECL_CONTEXT Hmm, that seems wrong: "A deduction-guide shall be declar

Re: PING [PATCH] avoid -Warray-bounds checks for vtable assignments (PR 98266)

2021-02-25 Thread Jason Merrill via Gcc-patches
On 2/25/21 6:47 PM, Jeff Law wrote: On 2/23/21 2:52 PM, Jason Merrill wrote: I don't see how the issue here depends on the artificiality of the vptr; That's what I was trying to get at -- is DECL_ARTIFICIAL really a good way to detect these kinds of cases.  It sounds like it likely isn't, bu

[pushed] c++: Fix class NTTP constness handling [PR98810]

2021-02-25 Thread Jason Merrill via Gcc-patches
Here, when substituting still-dependent args into an alias template, we see a non-const type because the default argument is non-const, and is not a template parm object because it's still dependent. Tested x86_64-pc-linux-gnu, applying to trunk. gcc/cp/ChangeLog: PR c++/98810 *

[pushed] c++: Allow GNU attributes before lambda -> [PR90333]

2021-02-27 Thread Jason Merrill via Gcc-patches
In my 9.3/10 patch for 90333 I allowed attributes between [] and (), and after the trailing return type, but not in the place that GCC 8 expected them, and we've gotten several bug reports about that. So let's allow them there, as well. Tested x86_64-pc-linux-gnu, applying to trunk. gcc/cp/Chang

Re: [PATCH] coroutines : Remove throwing_cleanup marks from the ramp [PR95822].

2021-02-27 Thread Jason Merrill via Gcc-patches
On 2/26/21 4:36 PM, Iain Sandoe wrote: Jason Merrill wrote: On 2/24/21 3:06 PM, Iain Sandoe wrote: The FE contains a mechanism for cleaning up return expressions if a function throws during the execution of cleanups prior to the return. If the original function has a return value with a non

Re: [PATCH] C++: target attribute - local decl

2021-03-01 Thread Jason Merrill via Gcc-patches
On 3/1/21 7:43 AM, Martin Liška wrote: On 2/22/21 11:53 PM, Jason Merrill wrote: The problem seems to be with the handling of local decls.  If DECL_LOCAL_DECL_P, you need to look at DECL_LOCAL_DECL_ALIAS to find the namespace-scope decl.  But then if there is no preceding namespace-scope decla

Re: [PATCH] C++: target attribute - local decl

2021-03-01 Thread Jason Merrill via Gcc-patches
On 3/1/21 11:59 AM, Martin Liška wrote: On 3/1/21 5:36 PM, Jason Merrill wrote: On 3/1/21 7:43 AM, Martin Liška wrote: On 2/22/21 11:53 PM, Jason Merrill wrote: The problem seems to be with the handling of local decls.  If DECL_LOCAL_DECL_P, you need to look at DECL_LOCAL_DECL_ALIAS to find t

Re: [PATCH] c++: ICE with deduction guide in checking type-dep [PR99009, PR97034]

2021-03-01 Thread Jason Merrill via Gcc-patches
On 3/1/21 2:54 PM, Marek Polacek wrote: On Thu, Feb 25, 2021 at 10:45:29PM -0500, Jason Merrill via Gcc-patches wrote: On 2/25/21 5:41 PM, Marek Polacek wrote: On Thu, Feb 25, 2021 at 10:59:49AM -0500, Jason Merrill wrote: On 2/12/21 6:12 PM, Marek Polacek wrote: We represent deduction

Re: [PATCH] avoid -Wnonull for dynamic_cast (PR 99251)

2021-03-01 Thread Jason Merrill via Gcc-patches
On 3/1/21 12:10 PM, Martin Sebor wrote: On 2/24/21 8:13 PM, Jason Merrill wrote: On 2/24/21 5:25 PM, Martin Sebor wrote: In r11-6900 (PR 98646 - static_cast confuses -Wnonnull) we decided that issuing -Wnonnull for dereferencing the result of dynamic_cast was helpful despite the false positives

Re: [PATCH 3/4] c++: Delay normalizing nested requirements until satisfaction

2021-03-01 Thread Jason Merrill via Gcc-patches
On 2/28/21 12:40 PM, Patrick Palka wrote: On Fri, 12 Feb 2021, Jason Merrill wrote: On 2/10/21 9:41 AM, Patrick Palka wrote: On Tue, 9 Feb 2021, Jason Merrill wrote: On 2/8/21 2:03 PM, Patrick Palka wrote: This sets up the functionality for controlling the initial set of template parameters

Re: [PATCH 4/4] c++: dependent constraint on placeholder 'auto' [PR96443]

2021-03-01 Thread Jason Merrill via Gcc-patches
On 2/28/21 12:55 PM, Patrick Palka wrote: On Fri, 12 Feb 2021, Jason Merrill wrote: On 2/11/21 5:14 PM, Patrick Palka wrote: On Thu, 11 Feb 2021, Jason Merrill wrote: On 2/8/21 2:03 PM, Patrick Palka wrote: This fixes the way we check satisfaction of constraints on placeholder types in vari

Re: [PATCH 5/6] c++: Clean up normalization / satisfaction routines

2021-03-01 Thread Jason Merrill via Gcc-patches
On 2/28/21 12:58 PM, Patrick Palka wrote: This patch mostly performs some straightforward refactoring: - Renamed satisfy_constraint to satisfy_normalized_constraints - Renamed the three-parameter version of satisfy_constraint_expression to satisfy_nondeclaration_constraints - Remov

Re: [PATCH 6/6] c++: Consolidate REQUIRES_EXPR evaluation/diagnostic routines

2021-03-01 Thread Jason Merrill via Gcc-patches
On 2/28/21 12:59 PM, Patrick Palka wrote: This folds the diagnose_requires_expr routines into the corresponding tsubst_requires_expr ones. This is achieved by making the latter routines take a sat_info instead of a subst_info, and assigning the appropriate meanings to the flags sat_info::noisy a

Re: [PATCH 3/4] c++: Delay normalizing nested requirements until satisfaction

2021-03-01 Thread Jason Merrill via Gcc-patches
On 3/1/21 6:09 PM, Patrick Palka wrote: On Mon, 1 Mar 2021, Jason Merrill wrote: On 2/28/21 12:40 PM, Patrick Palka wrote: On Fri, 12 Feb 2021, Jason Merrill wrote: On 2/10/21 9:41 AM, Patrick Palka wrote: On Tue, 9 Feb 2021, Jason Merrill wrote: On 2/8/21 2:03 PM, Patrick Palka wrote: T

Re: [PATCH] c++: ICE with deduction guide in checking type-dep [PR99009, PR97034]

2021-03-01 Thread Jason Merrill via Gcc-patches
On 3/1/21 7:59 PM, Marek Polacek wrote: On Mon, Mar 01, 2021 at 03:08:58PM -0500, Jason Merrill wrote: On 3/1/21 2:54 PM, Marek Polacek wrote: On Thu, Feb 25, 2021 at 10:45:29PM -0500, Jason Merrill via Gcc-patches wrote: On 2/25/21 5:41 PM, Marek Polacek wrote: On Thu, Feb 25, 2021 at 10:59

Re: [PATCH] avoid -Wnonull for dynamic_cast (PR 99251)

2021-03-01 Thread Jason Merrill via Gcc-patches
On 3/1/21 7:44 PM, Martin Sebor wrote: On 3/1/21 1:33 PM, Jason Merrill wrote: On 3/1/21 12:10 PM, Martin Sebor wrote: On 2/24/21 8:13 PM, Jason Merrill wrote: On 2/24/21 5:25 PM, Martin Sebor wrote: In r11-6900 (PR 98646 - static_cast confuses -Wnonnull) we decided that issuing -Wnonnull for

Re: PING [PATCH] avoid -Warray-bounds checks for vtable assignments (PR 98266)

2021-03-02 Thread Jason Merrill via Gcc-patches
On 3/1/21 6:11 PM, Martin Sebor wrote: On 2/24/21 5:35 PM, Jason Merrill wrote: On 2/23/21 6:07 PM, Martin Sebor wrote: On 2/23/21 2:52 PM, Jason Merrill wrote: On 2/23/21 11:02 AM, Martin Sebor wrote: [CC Jason for any further comments/clarification] On 2/9/21 10:49 AM, Martin Sebor wrote:

Re: [PATCH] C++: target attribute - local decl

2021-03-02 Thread Jason Merrill via Gcc-patches
On 3/2/21 5:34 AM, Martin Liška wrote: On 3/1/21 8:58 PM, Jason Merrill wrote: On 3/1/21 11:59 AM, Martin Liška wrote: On 3/1/21 5:36 PM, Jason Merrill wrote: On 3/1/21 7:43 AM, Martin Liška wrote: On 2/22/21 11:53 PM, Jason Merrill wrote: The problem seems to be with the handling of local de

Re: [PATCH] c++: Private parent access check for using decls [PR19377]

2021-03-02 Thread Jason Merrill via Gcc-patches
On 3/1/21 5:11 PM, Anthony Sharp wrote: Hi all, Here is the patch as promised. Regression tested on the c++ side and everything seems okay. Compiles fine. Sounds good, though strip_using_decl (parent_field) may be overloaded if the using-decl brings in multiple functions with that nam

Re: [PATCH 5/6] c++: Clean up normalization / satisfaction routines

2021-03-02 Thread Jason Merrill via Gcc-patches
On 3/2/21 11:25 AM, Patrick Palka wrote: On Mon, 1 Mar 2021, Jason Merrill wrote: On 2/28/21 12:58 PM, Patrick Palka wrote: This patch mostly performs some straightforward refactoring: - Renamed satisfy_constraint to satisfy_normalized_constraints - Renamed the three-parameter version

Re: [PATCH 6/6] c++: Consolidate REQUIRES_EXPR evaluation/diagnostic routines

2021-03-02 Thread Jason Merrill via Gcc-patches
On 3/2/21 11:45 AM, Patrick Palka wrote: On Mon, 1 Mar 2021, Jason Merrill wrote: On 2/28/21 12:59 PM, Patrick Palka wrote: This folds the diagnose_requires_expr routines into the corresponding tsubst_requires_expr ones. This is achieved by making the latter routines take a sat_info instead o

[pushed] c++: C++17 and decltype of multi-operator expression [PR95675]

2021-03-03 Thread Jason Merrill via Gcc-patches
A call that is the immediate operand of decltype has special semantics: no temporary is produced, so it's OK for the return type to be e.g. incomplete. But we were treating (e | f) the same way, which confused overload resolution when we then tried to evaluate ... | g. Fixed by making build_temp d

Re: [PATCH v2] c++: ICE with deduction guide in checking type-dep [PR99009, PR97034]

2021-03-03 Thread Jason Merrill via Gcc-patches
On 3/2/21 4:51 PM, Marek Polacek wrote: On Mon, Mar 01, 2021 at 09:29:19PM -0500, Jason Merrill via Gcc-patches wrote: On 3/1/21 7:59 PM, Marek Polacek wrote: On Mon, Mar 01, 2021 at 03:08:58PM -0500, Jason Merrill wrote: On 3/1/21 2:54 PM, Marek Polacek wrote: On Thu, Feb 25, 2021 at 10:45

Re: [PATCH] c++: Fix -fstrong-eval-order for operator &&, || and , [PR82959]

2021-03-03 Thread Jason Merrill via Gcc-patches
On 3/2/21 6:10 PM, Jakub Jelinek wrote: Hi! P0145R3 added "However, the operands are sequenced in the order prescribed for the built-in operator" rule for overloaded operator calls when using the operator syntax. op_is_ordered follows that, but added just the overloaded operators added in that p

Re: [PATCH] coroutines: Correct frame capture of compiler temps [PR95591+4].

2021-03-03 Thread Jason Merrill via Gcc-patches
I notice this patch includes + var_nest_node () = default; which will break GCC 10 bootstrap with a C++98 compiler; we only switched to C++11 for GCC 11. On Fri, Jul 17, 2020 at 8:57 AM Nathan Sidwell wrote: > > On 7/17/20 3:37 AM, Richard Biener wrote: > > On Thu, Jul 16, 2020 at 7:39 PM Nat

Re: PING [PATCH] avoid -Warray-bounds checks for vtable assignments (PR 98266)

2021-03-03 Thread Jason Merrill via Gcc-patches
On 3/3/21 6:20 PM, Martin Sebor wrote: On 3/2/21 7:11 AM, Jason Merrill wrote: On 3/1/21 6:11 PM, Martin Sebor wrote: On 2/24/21 5:35 PM, Jason Merrill wrote: On 2/23/21 6:07 PM, Martin Sebor wrote: On 2/23/21 2:52 PM, Jason Merrill wrote: On 2/23/21 11:02 AM, Martin Sebor wrote: [CC Jason

Re: [PATCH] c++: Fix up [[nodiscard]] on ctors on targetm.cxx.cdtor_returns_this targets [PR99362]

2021-03-04 Thread Jason Merrill via Gcc-patches
On 3/4/21 4:53 AM, Jakub Jelinek wrote: Hi! In the P1771R1 changes JeanHeyd reverted part of Alex' PR88146 fix, but that seems to be incorrect to me. Where P1771R1 suggests warnings for [[nodiscard]] on constructors is handled in a different place - in particular the TARGET_EXPR handling of conv

Re: [PATCH] C++: target attribute - local decl

2021-03-04 Thread Jason Merrill via Gcc-patches
On 3/4/21 3:19 AM, Martin Liška wrote: On 3/2/21 6:57 PM, Jason Merrill wrote: On 3/2/21 5:34 AM, Martin Liška wrote: On 3/1/21 8:58 PM, Jason Merrill wrote: On 3/1/21 11:59 AM, Martin Liška wrote: On 3/1/21 5:36 PM, Jason Merrill wrote: On 3/1/21 7:43 AM, Martin Liška wrote: On 2/22/21 11:

Re: [PATCH] C++: target attribute - local decl

2021-03-04 Thread Jason Merrill via Gcc-patches
On 3/4/21 10:39 AM, Martin Liška wrote: On 3/4/21 4:03 PM, Jason Merrill wrote: Do you really need to register all these pairs?  I was expecting that you'd just look through DECL_LOCAL_DECL_ALIAS and then register the pair you end up with.  Local decls shouldn't need a cgraph node. Well, doin

Re: PING [PATCH] avoid -Warray-bounds checks for vtable assignments (PR 98266)

2021-03-04 Thread Jason Merrill via Gcc-patches
On 3/4/21 12:44 PM, Martin Sebor wrote: On 3/3/21 10:33 PM, Jason Merrill wrote: On 3/3/21 6:20 PM, Martin Sebor wrote: ... I see what you mean, thanks, but I can't think of a test case to trigger a false negative due to the smaller offset.  Any suggestions? My only ideas involve undefined b

Re: [PATCH] C++: target attribute - local decl

2021-03-04 Thread Jason Merrill via Gcc-patches
On 3/4/21 10:52 AM, Martin Liška wrote: On 3/4/21 4:45 PM, Jason Merrill wrote: Sure, I guess you do need to set that flag for the local decls, but that should be all. Jason Doing that also fails :/ This time likely due to how we set RECORD argument of maybe_version_functions function:

Re: [PATCH] c++: adc_unify deduction with constrained auto [PR99365]

2021-03-04 Thread Jason Merrill via Gcc-patches
On 3/4/21 11:32 AM, Patrick Palka wrote: On Thu, 4 Mar 2021, Patrick Palka wrote: My recent r11-7454 changed the way do_auto_deduction handles constrained placeholders during template argument deduction (context == adc_unify) when processing_template_decl != 0. Before the patch, when processin

Re: [PATCH] c++: adc_unify deduction with constrained auto [PR99365]

2021-03-05 Thread Jason Merrill via Gcc-patches
On 3/4/21 9:55 PM, Patrick Palka wrote: On Thu, 4 Mar 2021, Patrick Palka wrote: On Thu, 4 Mar 2021, Patrick Palka wrote: On Thu, 4 Mar 2021, Jason Merrill wrote: On 3/4/21 11:32 AM, Patrick Palka wrote: On Thu, 4 Mar 2021, Patrick Palka wrote: My recent r11-7454 changed the way do_auto_

Re: [PATCH] c++: adc_unify deduction with constrained auto [PR99365]

2021-03-05 Thread Jason Merrill via Gcc-patches
On 3/5/21 3:42 PM, Patrick Palka wrote: On Fri, 5 Mar 2021, Jason Merrill wrote: On 3/4/21 9:55 PM, Patrick Palka wrote: On Thu, 4 Mar 2021, Patrick Palka wrote: On Thu, 4 Mar 2021, Patrick Palka wrote: On Thu, 4 Mar 2021, Jason Merrill wrote: On 3/4/21 11:32 AM, Patrick Palka wrote: On

Re: [PATCH] c++: Fix constexpr evaluation of pre-increment when !lval [PR99287]

2021-03-05 Thread Jason Merrill via Gcc-patches
On 3/5/21 1:05 PM, Patrick Palka wrote: Here, during cxx_eval_increment_expression (with lval=false) of ++__first where __first is &"mystr"[0], we correctly update __first to &"mystr"[1] but we end up returning &"mystr"[0] + 1 instead of &"mystr"[1]. This unreduced return value inhibits other po

Re: [PATCH] c++: Fix tsubsting member variable template-id [PR96330]

2021-03-05 Thread Jason Merrill via Gcc-patches
On 3/5/21 1:04 PM, Patrick Palka wrote: This makes tsubst_copy appropriately handle a variable template-id, which in turn fixes tsubsting a COMPONENT_REF whose member operand is known at parse time to be a variable template-id, as in the initialization of 'x' in the first testcase. Previously, w

Re: [PATCH] c++: ICE with -Wshadow and enumerator in template [PR99120]

2021-03-05 Thread Jason Merrill via Gcc-patches
On 3/5/21 11:44 AM, Marek Polacek wrote: We crash here, because in a template, an enumerator doesn't have a type until we've called finish_enum_value_list. But our -Wshadow implementation, check_local_shadow, is called when we pushdecl in build_enumerator, which takes place before finish_enum_va

Re: [PATCH] c++: Pointer-to-member fn conversion with noexcept [PR99374]

2021-03-05 Thread Jason Merrill via Gcc-patches
On 3/4/21 6:19 PM, Marek Polacek wrote: The issue in this PR is that we wrongly reject converting pointers to member function of incomplete types, one of which has noexcept. Recall that pointers (including pointers to member functions) to non-throwing functions can be implicitly converted to pot

Re: [PATCH] c++: -Wconversion vs value-dependent expressions [PR99331]

2021-03-05 Thread Jason Merrill via Gcc-patches
On 3/4/21 9:37 PM, Marek Polacek wrote: This PR complains that we issue a -Wconversion warning in template struct X {}; template X foo(); saying "conversion from 'long unsigned int' to 'int' may change value". While it's not technically wrong, I suspect -Wconversion warnings aren't all

Re: [PATCH] testsuite: Fix up attr-flatten-1.c failure [PR99363]

2021-03-05 Thread Jason Merrill via Gcc-patches
On 3/5/21 3:44 PM, Jakub Jelinek wrote: On Wed, Feb 24, 2021 at 07:08:34PM -0500, Jason Merrill via Gcc-patches wrote: gcc/ChangeLog: PR c++/96078 * cgraphunit.c (process_function_and_variable_attributes): Don't warn about flatten on an alias if the target also h

Re: [PATCH] c++: ICE with real-to-int conversion in template [PR97973]

2021-03-05 Thread Jason Merrill via Gcc-patches
On 3/3/21 7:55 PM, Marek Polacek wrote: In this test we are building a call in a template, but since neither the function nor any of its arguments are dependent, we go down the normal path in finish_call_expr. convert_arguments sees that we're binding a reference to int to double and therein con

Re: [PATCH] c++: Fix constexpr evaluation of pre-increment when !lval [PR99287]

2021-03-06 Thread Jason Merrill via Gcc-patches
On 3/5/21 5:18 PM, Patrick Palka wrote: On Fri, 5 Mar 2021, Jason Merrill wrote: On 3/5/21 1:05 PM, Patrick Palka wrote: Here, during cxx_eval_increment_expression (with lval=false) of ++__first where __first is &"mystr"[0], we correctly update __first to &"mystr"[1] but we end up returning &"

Re: [PATCH] c++: Fix ICE on defaulted spaceship with pointer return type [PR94162]

2021-08-11 Thread Jason Merrill via Gcc-patches
On 8/10/21 4:39 AM, Jakub Jelinek wrote: Hi! The spaceship-synth-neg6.C testcase ICEs because we call cat_tag_for on the explicit return type, but pointer types don't have TYPE_LINKAGE_IDENTIFIER. The patch fixes that. Or should I be checking for if (!CLASS_TYPE_P (type)) return cc_last; instea

Re: [PATCH] c++: Improve memory usage of subsumption [PR100828]

2021-08-11 Thread Jason Merrill via Gcc-patches
On 8/9/21 5:07 PM, Patrick Palka wrote: On Wed, Jul 28, 2021 at 4:42 PM Jason Merrill wrote: On 7/19/21 6:05 PM, Patrick Palka wrote: Constraint subsumption is implemented in two steps. The first step computes the disjunctive (or conjunctive) normal form of one of the constraints, and the se

Re: [PATCH] c++: recognize class-scope non-template dguides [PR79501]

2021-08-11 Thread Jason Merrill via Gcc-patches
On 8/9/21 1:16 PM, Patrick Palka wrote: It looks like we still don't recognize class-scope non-template deduction guides even after r12-2260. This is because deduction guides are handled in cp_parser_init_declarator after calling cp_parser_declarator, but in the class-scope non-template case we

Re: [PATCH] c++: Improve memory usage of subsumption [PR100828]

2021-08-11 Thread Jason Merrill via Gcc-patches
On 8/11/21 10:53 AM, Patrick Palka wrote: On Wed, 11 Aug 2021, Jason Merrill wrote: On 8/9/21 5:07 PM, Patrick Palka wrote: On Wed, Jul 28, 2021 at 4:42 PM Jason Merrill wrote: On 7/19/21 6:05 PM, Patrick Palka wrote: Constraint subsumption is implemented in two steps. The first step comp

Re: [PATCH] c++: Fix ICE on defaulted spaceship with pointer return type [PR94162]

2021-08-11 Thread Jason Merrill via Gcc-patches
On 8/11/21 10:01 AM, Jakub Jelinek wrote: On Wed, Aug 11, 2021 at 09:42:56AM -0400, Jason Merrill wrote: Checking CLASS_TYPE_P && decl_in_std_namespace (TYPE_MAIN_DECL) before looking at the name makes sense to me. CLASS_TYPE_P is cheap, but isn't decl_in_std_namespace, especially when it need

Re: [PATCH] c++: most vexing parse and braced CTAD [PR89062]

2021-08-11 Thread Jason Merrill via Gcc-patches
On 8/9/21 1:15 PM, Patrick Palka wrote: Here grokdeclarator is emitting the error error: class template placeholder ‘Foo’ not permitted in this context during the tentative (and ultimately futile) parse of 'x' as a function declaration. This happens because when parsing 'Foo{1}', cp_parser_

Re: [PATCH] c++: recognize class-scope non-template dguides [PR79501]

2021-08-11 Thread Jason Merrill via Gcc-patches
On 8/11/21 2:29 PM, Patrick Palka wrote: On Wed, 11 Aug 2021, Jason Merrill wrote: On 8/9/21 1:16 PM, Patrick Palka wrote: It looks like we still don't recognize class-scope non-template deduction guides even after r12-2260. This is because deduction guides are handled in cp_parser_init_decl

Re: [PATCH] c++: suppress all warnings on memper pointers to work around dICE [PR101219]

2021-08-11 Thread Jason Merrill via Gcc-patches
On 8/6/21 11:34 AM, Sergei Trofimovich wrote: On Thu, 29 Jul 2021 11:41:39 -0400 Jason Merrill wrote: On 7/22/21 7:15 PM, Sergei Trofimovich wrote: From: Sergei Trofimovich r12-1804 ("cp: add support for per-location warning groups.") among other things removed warning suppression from a fe

Re: [PATCH] c++: Optimize constinit thread_local vars [PR101786]

2021-08-11 Thread Jason Merrill via Gcc-patches
On 8/6/21 4:16 AM, Jakub Jelinek wrote: Hi! The paper that introduced constinit mentioned in rationale that constinit can be used on externs as well and that it can be used to avoid the thread_local initialization wrappers, because the standard requires that if constinit is present on any declar

Re: [PATCH] c++: Fix up parsing of attributes for using-directive

2021-08-11 Thread Jason Merrill via Gcc-patches
On 8/4/21 6:05 AM, Jakub Jelinek wrote: Hi! As I've said earlier and added xfails in gen-attrs-76.C test, https://eel.is/c++draft/namespace.udir#nt:using-directive has attribute-specifier-seq[opt] at the start, not at the end before ; as gcc is expecting. IMHO we should continue parsing at the e

Re: [PATCH] c++: parameterized requires-expr as default argument [PR101725]

2021-08-11 Thread Jason Merrill via Gcc-patches
On 8/3/21 4:04 PM, Patrick Palka wrote: Here we're rejecting the default template argument requires (T t) { x(t); } because we consider the 't' in the requirement to be a local variable (according to local_variable_p), and we generally forbid local variables from appearing inside template ar

Re: [PATCH] c++: parameterized requires-expr as default argument [PR101725]

2021-08-11 Thread Jason Merrill via Gcc-patches
On 8/3/21 4:04 PM, Patrick Palka wrote: Here we're rejecting the default template argument requires (T t) { x(t); } because we consider the 't' in the requirement to be a local variable (according to local_variable_p), and we generally forbid local variables from appearing inside template ar

Re: [PATCH] c++: constexpr std::construct_at on empty field [PR101663]

2021-08-11 Thread Jason Merrill via Gcc-patches
On 8/3/21 4:04 PM, Patrick Palka wrote: Here during constexpr evaluation of std::construct_at(&a._M_value) we find ourselves in cxx_eval_store_expression where the target object is 'a._M_value' and the initializer is {}. Since _M_value is an empty [[no_unique_address]] member we don't creat

Re: [PATCH] c++: Implement P0466R5 __cpp_lib_is_layout_compatible compiler helpers [PR101539]

2021-08-12 Thread Jason Merrill via Gcc-patches
On 8/3/21 3:05 AM, Jakub Jelinek wrote: Hi! The following patch implements __is_layout_compatible trait and __builtin_is_corresponding_member helper function for the std::is_corresponding_member template function. For now it implements the IMHO buggy but standard definition of layout-compatible

Re: [PATCH] c++: suppress all warnings on memper pointers to work around dICE [PR101219]

2021-08-12 Thread Jason Merrill via Gcc-patches
On 8/11/21 6:36 PM, Sergei Trofimovich wrote: On Wed, 11 Aug 2021 15:19:58 -0400 Jason Merrill wrote: On 8/6/21 11:34 AM, Sergei Trofimovich wrote: On Thu, 29 Jul 2021 11:41:39 -0400 Jason Merrill wrote: On 7/22/21 7:15 PM, Sergei Trofimovich wrote: From: Sergei Trofimovich r12-1804

Re: [PATCH] libcpp: Fix ICE with -Wtraditional preprocessing [PR101638]

2021-08-12 Thread Jason Merrill via Gcc-patches
On 8/12/21 3:57 AM, Jakub Jelinek wrote: Hi! The following testcase ICEs in cpp_sys_macro_p, because cpp_sys_macro_p is called for a builtin macro which doesn't use node->value.macro union member but a different one and so dereferencing it ICEs. As the testcase is distilled from contemporary gli

Re: [PATCH] c++: Implement P0466R5 __cpp_lib_is_layout_compatible compiler helpers [PR101539]

2021-08-12 Thread Jason Merrill via Gcc-patches
On 8/12/21 11:16 AM, Jakub Jelinek wrote: On Thu, Aug 12, 2021 at 10:33:20AM -0400, Jason Merrill wrote: The following patch implements __is_layout_compatible trait and __builtin_is_corresponding_member helper function for the std::is_corresponding_member template function. For now it implements

Re: [PATCH] Fix ICE when mixing VLAs and statement expressions [PR91038]

2021-08-15 Thread Jason Merrill via Gcc-patches
On 8/1/21 1:36 PM, Uecker, Martin wrote: Here is an attempt to fix some old and annoying bugs related to VLAs and statement expressions. In particulary, this seems to fix the issues with variably-modified types which are returned from statement expressions (which works on clang), but there are

Re: [PATCH] c++, v2: Implement P0466R5 __cpp_lib_is_layout_compatible compiler helpers [PR101539]

2021-08-16 Thread Jason Merrill via Gcc-patches
On 8/12/21 1:07 PM, Jakub Jelinek wrote: On Thu, Aug 12, 2021 at 12:06:33PM -0400, Jason Merrill wrote: Yes; if the standard says something nonsensical, I prefer to figure out something more sensible to propose as a change. Ok, so here it is implemented, so far tested only on the new testcases

Re: [PATCH] c++: aggregate CTAD and brace elision [PR101344]

2021-08-16 Thread Jason Merrill via Gcc-patches
On 8/16/21 3:06 PM, Patrick Palka wrote: During aggregate CTAD, collect_ctor_idx_types always recurses into a sub-CONSTRUCTOR, regardless of whether the corresponding pair of braces was elided in the original initializer. This causes us to reject some completely-braced forms of aggregate CTAD as

Re: [PATCH] c++: ignore explicit dguides during NTTP CTAD [PR101883]

2021-08-16 Thread Jason Merrill via Gcc-patches
On 8/16/21 3:06 PM, Patrick Palka wrote: Since (template) argument passing is a copy-initialization context, we mustn't consider explicit deduction guides when deducing a CTAD placeholder type of an NTTP. Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk/11? OK.

Re: [PATCH] libcpp: __VA_OPT__ p1042r1 placemarker changes [PR101488]

2021-08-16 Thread Jason Merrill via Gcc-patches
On 7/20/21 5:50 AM, Jakub Jelinek wrote: Hi! So, besides missing #__VA_OPT__ patch for which I've posted patch last week, P1042R1 introduced some placemarker changes for __VA_OPT__, most notably the addition of before "removal of placemarker tokens," rescanning ... and the #define H4(X, ...) __V

Re: [PATCH] libcpp, v2: Implement C++23 P1949R7 - C++ Identifier Syntax using Unicode Standard Annex 31

2021-08-16 Thread Jason Merrill via Gcc-patches
On 8/16/21 4:51 PM, Jakub Jelinek wrote: On Mon, Aug 16, 2021 at 04:21:00PM -0400, Jason Merrill wrote: I see for the UTF-8 chars we have: switch (ucn_valid_in_identifier (pfile, *cp, nst)) { case 0: /* In C++, this is an error for invalid character in an

Re: [PATCH] c++: Add C++20 #__VA_OPT__ support

2021-08-16 Thread Jason Merrill via Gcc-patches
On 7/15/21 1:52 PM, Jakub Jelinek wrote: Hi! The following patch implements C++20 # __VA_OPT__ (...) support. Testcases cover what I came up with myself and what LLVM has for #__VA_OPT__ in its testsuite and the string literals are identical between the two compilers on the va-opt-5.c testcase.

Re: [PATCH] c++, v3: Implement P0466R5 __cpp_lib_is_layout_compatible compiler helpers [PR101539]

2021-08-17 Thread Jason Merrill via Gcc-patches
On 8/17/21 6:44 AM, Jakub Jelinek wrote: On Mon, Aug 16, 2021 at 03:57:21PM -0400, Jason Merrill wrote: +static tree +is_corresponding_member_aggr (location_t loc, tree basetype1, tree membertype1, + tree arg1, tree basetype2, tree membertype2, +

Re: [PATCH] libcpp: __VA_OPT__ p1042r1 placemarker changes [PR101488]

2021-08-17 Thread Jason Merrill via Gcc-patches
On 8/17/21 4:25 AM, Jakub Jelinek wrote: On Mon, Aug 16, 2021 at 06:07:57PM -0400, Jason Merrill wrote: It is unclear if it would be enough to remove just one or if all padding tokens should be removed. Anyway, e.g. the previous removal of all padding tokens at the end of __VA_OPT__ is undesirab

Re: [PATCH] c++, v3: Implement P0466R5 __cpp_lib_is_layout_compatible compiler helpers [PR101539]

2021-08-17 Thread Jason Merrill via Gcc-patches
On 8/17/21 10:55 AM, Jakub Jelinek wrote: On Tue, Aug 17, 2021 at 07:10:28AM -0700, Jason Merrill wrote: Looks good, thanks. I think you didn't see that I also asked for some added comments; OK with those added. Oops, I've indeed missed them, sorry. On Mon, Aug 16, 2021 at 03:57:21PM -0400,

Re: [PATCH v4] c++: Add gnu::diagnose_as attribute

2021-08-17 Thread Jason Merrill via Gcc-patches
On 7/23/21 4:58 AM, Matthias Kretz wrote: Hi Jason, Hi, thanks for your patience; I've been out on PTO a lot in the last month, and will be again this week. I found a few regressions from the last patch in the meantime. Version 4 of the patch is attached. Questions: 1. I simplified the co

Re: [PATCH] c++: Fix cp_tree_equal for template value args using dependent sizeof/alignof/noexcept expressions

2021-08-25 Thread Jason Merrill via Gcc-patches
On 8/21/21 12:55 AM, Barrett Adair via Gcc-patches wrote: This patch fixes AST comparison for trailing return types using dependent sizeof/alignof/noexcept expressions as template value arguments. I believe this bug is over a decade old, hailing from GCC 4.6. I found it over 5 years ago and sat o

Re: [PATCH] c++: Fix up value initialization of structs with zero width bitfields [PR102019]

2021-08-25 Thread Jason Merrill via Gcc-patches
On 8/23/21 4:16 PM, Jakub Jelinek wrote: Hi! The removal of remove_zero_width_bit_fields, in addition to triggering some ABI issues that need solving anyway (ABI incompatibility between C and C++) also resulted in UB inside of gcc, we now call build_zero_init which calls build_int_cst on an inte

Re: [PATCH] Fix PR c++/66590: incorrect warning "reaches end of non-void function" for switch

2021-08-25 Thread Jason Merrill via Gcc-patches
On 8/13/21 2:40 PM, apinski--- via Gcc-patches wrote: From: Andrew Pinski So the problem here is there is code in the C++ front-end not to add a break statement (to the IR) if the previous block does not fall through. The problem is the code which does the check to see if the block may fallthro

Re: [PATCH] c++: error message for dependent template members [PR70417]

2021-08-27 Thread Jason Merrill via Gcc-patches
On 8/20/21 12:56 PM, Anthony Sharp via Gcc-patches wrote: Hi, hope everyone is well. I have a patch here for issue 70417 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70417). I'm still a GCC noob, and this is probably the hardest thing I have ever coded in my life, so please forgive any initial m

[pushed] c++: Set type on dependent ARROW_EXPR

2021-08-27 Thread Jason Merrill via Gcc-patches
Even if the operand of -> has dependent type, if it's a pointer we know that the result will be the target type of that pointer. This should avoid some unnecessary TYPEOF_EXPR when looking up a name after ->. Tested x86_64-pc-linux-gnu, applying to trunk. gcc/cp/ChangeLog: * typeck2.c (

[pushed] c++: Add warning about missing 'requires'

2021-08-30 Thread Jason Merrill via Gcc-patches
I noticed that concepts-lambda14.C had two useless requires-expressions: static_assert(requires { C; }); always succeeds, because C is always a valid expression for any type, regardless of whether C is satisfied for a particular type. Presumably the user means static_assert(requires { requi

[pushed] c++: fold function template args sooner [PR101460]

2021-08-30 Thread Jason Merrill via Gcc-patches
As discussed in the PR, we were giving a lot of unnecessary errors for this testcase because we didn't try to do constant evaluation until convert_nontype_argument, which happens for each of the candidates. But when looking at a template-id as the function operand of a call, we can try to fold arg

[pushed] c++: preserve location through constexpr

2021-08-30 Thread Jason Merrill via Gcc-patches
While working on the patch for PR101460, I noticed that we were losing the expression location when folding class prvalue expressions. The final patch doesn't fold class prvalues, but this still seems a worthwhile change. I don't add location wrappers for scalar prvalues because many callers are

[pushed] c++: limit instantiation with ill-formed class [PR96286]

2021-08-30 Thread Jason Merrill via Gcc-patches
I noticed that after the static_assert failures in lwg3466.cc, we got various follow-on errors because we went ahead and tried to instantiate the promise member functions even after instantiating the class itself ran into problems. Interrupting instantiation of the class itself seems likely to cau

Re: [PATCH] c++: check arity before deduction w/ explicit targs [PR12672]

2021-08-31 Thread Jason Merrill via Gcc-patches
On 8/30/21 9:26 PM, Patrick Palka wrote: During overload resolution, when the arity of a function template clearly disagrees with the arity of the call, no specialization of the function template could yield a viable candidate. The deduction routine type_unification_real already notices this sit

[pushed] c++: Improve error recovery with constexpr [PR92193]

2021-08-31 Thread Jason Merrill via Gcc-patches
The compiler tries to limit error cascades in limit_bad_template_recursion by avoiding triggering a new instantiation from one that has caused errors. We were exempting constexpr functions from this because they can be needed for constant evaluation, but as more and more functions get marked conste

Re: PSA: Default C++ dialect is now C++17

2020-09-14 Thread Jason Merrill via Gcc-patches
On Mon, Jun 29, 2020 at 1:25 PM Martin Liška wrote: > > On 6/29/20 4:57 PM, Marek Polacek wrote: > > On Mon, Jun 29, 2020 at 09:51:57AM +0200, Martin Liška wrote: > >> On 6/26/20 9:34 PM, Marek Polacek via Gcc-patches wrote: > >>> As discussed last month: > >>>

Re: [PATCH] c++: premature analysis of requires-expression [PR96410]

2020-09-16 Thread Jason Merrill via Gcc-patches
On 9/16/20 1:34 PM, Patrick Palka wrote: On Thu, 13 Aug 2020, Jason Merrill wrote: On 8/13/20 11:21 AM, Patrick Palka wrote: On Mon, 10 Aug 2020, Jason Merrill wrote: On 8/10/20 2:18 PM, Patrick Palka wrote: On Mon, 10 Aug 2020, Patrick Palka wrote: In the below testcase, semantic analysi

<    1   2   3   4   5   6   7   8   9   10   >