Re: [PATCH v3 1/2] c++: Initial support for P0847R7 (Deducing This) [PR102609]

2023-11-02 Thread Jason Merrill
On 10/28/23 00:07, waffl3x wrote: I wanted to change DECL_NONSTATIC_MEMBER_FUNCTION_P to include explicit object member functions, but it had some problems when I made the modification. I also noticed that it's used in cp-objcp-common.cc so would making changes to it be a bad idea? -- cp-tree.h

Re: [PATCH v3] c++: implement P2564, consteval needs to propagate up [PR107687]

2023-11-03 Thread Jason Merrill
On 11/2/23 11:28, Marek Polacek wrote: On Sat, Oct 14, 2023 at 12:56:11AM -0400, Jason Merrill wrote: On 10/10/23 13:20, Marek Polacek wrote: On Tue, Aug 29, 2023 at 03:26:46PM -0400, Jason Merrill wrote: On 8/23/23 15:49, Marek Polacek wrote: +struct A { + int x; + int y = id(x

Re: [PATCH v3 1/2] c++: Initial support for P0847R7 (Deducing This) [PR102609]

2023-11-03 Thread Jason Merrill
On 11/3/23 00:44, waffl3x wrote: That leaves 2, 4, and 5. 2. I am pretty sure xobj functions should have the struct they are a part of recorded as the method basetype member. I have already checked that function_type and method_type are the same node type under the hood and it does appear to be,

Re: [PATCH] attribs: Fix ICE with -Wno-attributes= [PR112339]

2023-11-03 Thread Jason Merrill
LGTM but I'd like Marek to approve it. On Fri, Nov 3, 2023, 3:12 PM Jakub Jelinek wrote: > Hi! > > The following testcase ICEs, because with -Wno-attributes=foo::no_sanitize > (but generally any other non-gnu namespace and some gnu well known > attribute > name within that other namespace) the F

[C++ PATCH] Implement P1286R2, Contra CWG1778

2019-10-23 Thread Jason Merrill
The C++11 requirement that an explicit exception-specification on a defaulted function match the implicit one was found to be problematic for std::atomic. This paper, adopted in February, simply removes that requirement: if an explicitly defaulted function has a different exception-specification,

Re: [patch][trivial] Fix signed integer overflow in cp-demangle.c (d_number)

2019-10-28 Thread Jason Merrill
OK. On Mon, Oct 28, 2019 at 7:56 PM Paul Pluzhnikov via gcc-patches wrote: > > Greetings, > > This is rather on the trivial side. Google fuzzer found signed integer > overflow in d_number, given this input: _ZZccDF2147483647 > Google ref: b141647507. > > Ok for trunk? > > Thanks, > > libiberty/Ch

Re: [C++ PATCH] Partial fix for a recent regression (PR c++/90947)

2019-10-29 Thread Jason Merrill
On 10/22/19 11:03 AM, Jakub Jelinek wrote: Hi! The following patch is just a partial fix for a regression introduced in the PR90947 changes, the testcase is fixed for just C++17/20. type_initializer_zero_p has been added to the generic code, supposedly because similar initializer_zerop is in gen

Re: [C++ Patch] Improve build_x_unary_op locations

2019-10-29 Thread Jason Merrill
On 10/22/19 2:52 PM, Marek Polacek wrote: On Tue, Oct 22, 2019 at 08:48:30PM +0200, Paolo Carlini wrote: Hi, at the moment I'm going through more typeck.c and typeck2.c functions: the below are some straightforward changes for build_x_unary_op (fwiw, the resulting locations are also consistent

Re: C++ PATCH for c++/91548 - fix detecting modifying const objects for ARRAY_REF

2019-10-29 Thread Jason Merrill
On 10/23/19 2:10 PM, Marek Polacek wrote: This fixes a bogus "modifying a const object" error for an array that actually isn't declared const. The problem was how I handled ARRAY_REFs here; we shouldn't look at the ARRAY_REF itself, but at the array its accessing. Bootstrapped/regtested on x86_

Re: [C++ PATCH] Fix a C++17/20 regression on indirect function calls (PR c++/92201)

2019-10-29 Thread Jason Merrill
On 10/23/19 6:35 PM, Jakub Jelinek wrote: Hi! For middle-end pointer conversions are useless, which means the gimplifier can change the type of the value being gimplified. gimplify_call_expr is careful about this and remembers the fnptrtype early before gimplification and else /* Remembe

Re: C++ PATCH for c++/90998 - ICE with copy elision in init by ctor and -Wconversion

2019-10-29 Thread Jason Merrill
On 10/25/19 2:38 PM, Marek Polacek wrote: After r269667 which introduced joust_maybe_elide_copy, in C++17 we can elide a constructor if it uses a conversion function that returns a prvalue, and use the conversion function in its stead. This eliding means that if we have a candidate that previous

Re: [C++ Patch] Prefer error + inform in four typeck.c places

2019-10-29 Thread Jason Merrill
On 10/24/19 10:07 AM, Paolo Carlini wrote: Hi, some additional straightforward bits in typeck.c, which I noticed when I went through the cp_build_binary_op callers. Tested x86_64-linux. Thanks, Paolo. // OK.

Re: C++ PATCH for c++/91962 - ICE with reference binding and qualification conversion

2019-10-30 Thread Jason Merrill
On 10/24/19 3:24 PM, Marek Polacek wrote: When fixing c++/91889 (r276251) I was assuming that we couldn't have a ck_qual under a ck_ref_bind, and I was introducing it in the patch and so this + if (next_conversion (convs)->kind == ck_qual) + { + gcc_assert (same_type_p (TREE_TYPE (exp

Re: C++ PATCH for c++/92215 - flawed diagnostic for bit-field with non-integral type

2019-10-30 Thread Jason Merrill
On 10/24/19 5:50 PM, Marek Polacek wrote: I noticed that for code like struct S { int *foo : 3; }; we generate nonsensical r.C:2:8: error: function definition does not declare parameters 2 | int *foo : 3; It talks about a function because after parsing the declspecs of

Re: C++ PATCH for c++/92134 - constinit malfunction in static data member

2019-10-30 Thread Jason Merrill
On 10/24/19 6:30 PM, Marek Polacek wrote: I wasn't properly setting LOOKUP_CONSTINIT in grokfield and so we didn't detect a non-const initializer. Bootstrapped/regtested on x86_64-linux, ok for trunk? OK. 2019-10-24 Marek Polacek PR c++/92134 - constinit malfunction in static dat

[PATCH][C++] Use OVL_OP_INFO in get_fold_operator.

2019-10-30 Thread Jason Merrill
A cleanup I noticed while working on operator<=>. Tested x86_64-pc-linux-gnu, applying to trunk. --- gcc/cp/cxx-pretty-print.c | 48 ++- 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index 2

Re: [C++ PATCH] Fix up decl_in_std_namespace_p handling of --enable-symvers=gnu-versioned-namespace

2019-10-30 Thread Jason Merrill
On 10/30/19 9:30 AM, Marek Polacek wrote: On Wed, Oct 30, 2019 at 10:58:57AM +0100, Jakub Jelinek wrote: On Fri, Oct 25, 2019 at 10:44:18AM -0400, Marek Polacek wrote: That is... sneaky. I guess I/we need to test with --enable-symvers=gnu-versioned-namespace every now and then. Indeed. Pro

Re: [PATCH] Fix PR c++/92024

2019-10-30 Thread Jason Merrill
On 10/12/19 2:10 PM, Bernd Edlinger wrote: On 10/11/19 6:31 PM, Jason Merrill wrote: On 10/10/19 2:06 PM, Bernd Edlinger wrote: On 10/10/19 7:49 PM, Jason Merrill wrote: On 10/10/19 10:42 AM, Bernd Edlinger wrote: Hi, this fixes a crash when -Wshadow=compatible-local is enabled in the

Re: [C++ PATCH] P0784R7 constexpr new fixes (PR c++/91369)

2019-10-30 Thread Jason Merrill
On 10/24/19 5:11 AM, Jakub Jelinek wrote: Hi! Jonathan has showed me a testcase with std::allocator::{,de}allocate and std::construct_at which FAILs with the current constexpr new implementation. There are two problems that make the testcase rejected, and further issues (not addressed by this p

Re: [C++ PATCH] Implement P1073R3: Immediate functions (PR c++/88335)

2019-10-30 Thread Jason Merrill
On 10/24/19 7:47 AM, Jakub Jelinek wrote: On Tue, Oct 22, 2019 at 10:57:42AM -0400, Jason Merrill wrote: So, do you prefer to do it the other way during build_cxx_call? It seems more straightforward. I've tried this approach, but am running into issues: 1) the normal constructors aren

[C++ PATCH] PR c++/92268 - hard error satisfying return-type-requirement

2019-10-30 Thread Jason Merrill
Previously we would put the template arguments for the concept-check in a TEMPLATE_ID and then also pass them to constraints_satisfied_p, which meant that we would try to normalize the concept-check with the fully instantiated arguments, leading to sadness. Simply not passing the args to constrain

Re: [PATCH] PR c++/84810 - constraints on lambdas

2019-10-30 Thread Jason Merrill
On 10/30/19 7:20 AM, Jeff Chapman wrote: Hello, Attached is a patch that adds parsing of the optional requires-clause in a lambda-expression and lambda-declarator. Additionally, shorthand constraints from the template-parameter-list are now actually applied and constrain the synthesized operator

Re: [C++ PATCH] Fix a recent regression (PR c++/90947)

2019-10-30 Thread Jason Merrill
On 10/30/19 7:29 PM, Jakub Jelinek wrote: On Tue, Oct 29, 2019 at 04:26:14PM -0400, Jason Merrill wrote: I think type_initializer_zero_p should return false if CLASSTYPE_NON_AGGREGATE; we can't expect that value-initialization will have the intended effect in that case. That indeed work

Re: [C++ PATCH] P0784R7 constexpr new further fix (PR c++/91369)

2019-11-01 Thread Jason Merrill
On 10/31/19 1:10 PM, Jakub Jelinek wrote: On Wed, Oct 30, 2019 at 11:05:29PM +0100, Jakub Jelinek wrote: Looks like there used to be a TREE_CALLS_NEW flag in TREE_LANG_FLAG_1, but that flag is now free for CALL_EXPR. I'll try a CALL_EXPR flag first. TREE_LANG_FLAG_1 is also STMT_IS_FULL_EXPR

Re: [C++ PATCH] Implement P1073R3: Immediate functions (PR c++/88335, take 3)

2019-11-01 Thread Jason Merrill
On 10/31/19 1:21 PM, Jakub Jelinek wrote: On Wed, Oct 30, 2019 at 05:06:00PM -0400, Jason Merrill wrote: build_cplus_new does the magic of replacing a dummy argument, e.g. if (obj_arg && is_dummy_object (obj_arg)) { call = build_cplus_new (DECL

Re: [C++ Patch] Add location parameter to composite_pointer_type and use it

2019-11-01 Thread Jason Merrill
On 11/1/19 10:06 AM, Paolo Carlini wrote: Hi again, On 31/10/19 16:56, Paolo Carlini wrote: Hi, yesterday I noticed that we want to forward the location parameter of cp_build_binary_op to composite_pointer_type and then composite_pointer_error. Note, for the time being at least, this is alw

Re: [ C++ ] [ PATCH ] [ RFC ] p1301 - [[nodiscard("should have a reason")]]

2019-11-01 Thread Jason Merrill
On Sat, Oct 19, 2019 at 6:35 PM Jakub Jelinek wrote: > > Hi! > > On Sat, Oct 19, 2019 at 12:46:56AM -0400, Jason Merrill wrote: > > gcc/testsuite/g++.dg/cpp2a > > * nodiscard-construct.C: New test. > > * nodiscard-once.C: New test. >

Re: C++ PATCH for c++/91363 - P0960R3: Parenthesized initialization of aggregates

2019-11-01 Thread Jason Merrill
On 10/22/19 10:53 AM, Marek Polacek wrote: This patch implements C++20 P0960R3: Parenthesized initialization of aggregates (; see R0 for more background info). Essentially, if you have an aggregate, you can now initialize it by (x, y), similarly to {x, y}. E.g. struct A { int x, y;

Re: [C++ PATCH] Implement P1073R3: Immediate functions (PR c++/88335, take 3)

2019-11-01 Thread Jason Merrill
On 11/1/19 3:57 PM, Jakub Jelinek wrote: On Fri, Nov 01, 2019 at 03:42:58PM -0400, Jason Merrill wrote: + for (size_t n = cp_parser_skip_balanced_tokens (parser, 1); ; n++) + { + size_t after = cp_parser_skip_attributes_opt (parser, n); + if (after >

Re: C++ PATCH for c++/91363 - P0960R3: Parenthesized initialization of aggregates

2019-11-01 Thread Jason Merrill
On 11/1/19 4:42 PM, Marek Polacek wrote: On Fri, Nov 01, 2019 at 04:37:15PM -0400, Jason Merrill wrote: On 10/22/19 10:53 AM, Marek Polacek wrote: This patch implements C++20 P0960R3: Parenthesized initialization of aggregates (; see R0 for more background info). Essentially, if you have an

Re: [[PATCH][PR91979] handle mangling of nullptr expression ] updated the fix

2019-11-01 Thread Jason Merrill
On 10/31/19 2:06 PM, kamlesh kumar wrote: Jason, Can you please review this, let me know how can we handle -fabi-version? We should bump latest_abi_version in c-opts.c and use abi_version_at_least to control this change. On Wed, Oct 23, 2019 at 7:55 AM Kamlesh Kumar wrote: --- gcc/cp/m

Re: [C++ PATCH] Implement P1073R3: Immediate functions (PR c++/88335, take 3)

2019-11-01 Thread Jason Merrill
On 11/1/19 5:19 PM, Jakub Jelinek wrote: On Fri, Nov 01, 2019 at 09:56:44PM +0100, Jakub Jelinek wrote: Ah, used 8.x to test it. There have been r265787 and r269775 changes in between. Though auto d = [] () mutable __attribute__((noreturn)) constexpr {}; auto e = [] () mutable [[noreturn]

Re: [PATCH v2] [PR91979] Updated the fix:

2019-11-03 Thread Jason Merrill
On 11/1/19 11:47 PM, Kamlesh Kumar wrote: Changlogs gcc -- 2019-11-02 Kamlesh Kumar PR c++/91979 - mangling nullptr expression * mangle.c (write_template_arg_literal): Handle nullptr mangling. * testsuite/g++.dg/cpp0x/nullptr27.C: Modify Test.

[PATCH][C++] * typeck.c (check_return_expr): Avoid redundant error.

2019-11-04 Thread Jason Merrill
I noticed that when returning an ambiguous call in a void function, we then uselessly gave another error about returning a non-void expression. Tested x86_64-pc-linux-gnu, applying to trunk. --- gcc/cp/typeck.c | 2 +- gcc/testsuite/g++.dg/other/return2.C | 7 +++ 2 fil

Re: [PATCH v3] Updated the Fix:

2019-11-04 Thread Jason Merrill
On 11/3/19 6:42 AM, Kamlesh Kumar wrote: ChangeLog Entries: gcc/cp -- 2019-11-02 Kamlesh Kumar PR c++/91979 - mangling nullptr expression * cp/mangle.c (write_template_arg_literal): Handle nullptr mangling. gcc -- 2019-11-02 Kamlesh Kumar * co

Re: [C++ PATCH] Allow [[likely]] and [[unlikely]] in constexpr functions (PR c++/92343)

2019-11-05 Thread Jason Merrill
OK. I wonder why we're returning false for EMPTY_CLASS_EXPR? On Tue, Nov 5, 2019 at 7:35 AM Jakub Jelinek wrote: > > Hi! > > When Martin Liska added PREDICT_EXPR to potential_constant_expression_1, > it was with goto in mind and in that case goto isn't a potential > constant expression, but when

[C++ PATCH] diagnose address and decltype of unsatisfied function

2019-11-05 Thread Jason Merrill
trunk. commit 88d071f8e0a1637bc95e78c5a52ff44423946bfc Author: Jason Merrill Date: Tue Nov 5 10:44:34 2019 + Catch missed uses of function with unsatisfied constraints. While looking at CA378 I noticed that we weren't properly diagnosing two of the three erroneous li

[C++ PATCH] Various small C++ changes.

2019-11-05 Thread Jason Merrill
Wrappers for lookup_qualified_name and build_x_binary_op to make calling them more convenient in places, and a function named contextual_conv_bool for places that want contextual conversion to bool. I noticed that we weren't showing the declaration location when we complain about a call to a non-c

[C++ PATCH] Use vec instead of raw array for built-in candidates.

2019-11-05 Thread Jason Merrill
My operator<=> patch wants to split up build_new_op_1, which makes using a tree array as well as the vec inconvenient. build_new_op_1 already has a vec, and build_conditional_expr_1 can release its vec right away, so this doesn't increase garbage at all. Tested x86_64-pc-linux-gnu, applying to tr

Re: [C++ PATCH 2/4] Fix conversions for built-in operator overloading candidates.

2019-11-05 Thread Jason Merrill
I'm applying this patch again now, this time with a tweak to expmed.c to prevent the false positive warning from breaking bootstrap. I don't see any problem in the gimple output, so the bug must be in the middle-end somewhere. On Thu, Sep 19, 2019 at 8:43 PM Jason Merrill wrote

[C++ PATCH] Implement C++20 operator<=>.

2019-11-05 Thread Jason Merrill
There are three major pieces to this support: scalar operator<=>, synthesis of comparison operators, and rewritten/reversed overload resolution (e.g. a < b becomes 0 > b <=> a). Unlike other defaulted functions, where we use synthesized_method_walk to semi-simulate what the definition of the funct

Re: [PATCH] Fix parser to recognize operator?:

2019-11-06 Thread Jason Merrill
7;s what I'm applying: Jason commit c3e97f573b6e29324ef72ded63e0307cec8d2ce2 Author: Jason Merrill Date: Tue Nov 5 17:31:44 2019 + Fix parser to recognize operator?: This change lets grok_op_properties print its useful "ISO C++ prohibits overloading operator ?:" message inste

[PATCH] C++20 CA378 - Remove constrained non-template functions.

2019-11-06 Thread Jason Merrill
No real use cases have arisen for constraints on non-templated functions, and handling of them has never been entirely clear, so the committee agreed to accept this national body comment proposing that we remove them. Tested x86_64-pc-linux-gnu, applying to trunk. * decl.c (grokfndecl): R

C++ PATCH for nested requirements normalization

2019-11-06 Thread Jason Merrill
re comprehensive diagnostics, but do not enable. * parser.c (cp_parser_requires_expression): Relax requirement that requires-expressions can live only inside templates. * pt.c (any_template_parm_r): Look into type of PARM_DECL. 2019-11-0

[C++ PATCH] Implement D1907R1 "structural type".

2019-11-06 Thread Jason Merrill
ISO C++ paper D1907R1 proposes "structural type" as an alternative to the current notion of "strong structural equality", which has various problems. I'm implementing it to give people a chance to try it. The build_base_field changes are to make it easier for structural_type_p to see whether a bas

[C++ PATCH] Implement D1959R0, remove weak_equality and strong_equality.

2019-11-07 Thread Jason Merrill
Shortly after I finished implementing the previous <=> semantics, the committee decided to remove the *_equality comparison categories, because they were largely obsoleted by the earlier change that separated operator== from its original dependency on operator<=>. Tested x86_64-pc-linux-gnu, apply

Re: [C++ PATCH] PR c++/91370 - Implement P1041R4 and P1139R2 - Stronger Unicode reqs

2019-11-07 Thread Jason Merrill
OK. On 11/7/19 3:38 PM, Jakub Jelinek wrote: Hi! GCC does use UTF-16 and UTF-32 for char16_t and char32_t string literals already, so P1041R4 is I believe already implemented with no changes needed. While going through P1139R2, I've realized that we weren't handling "If the value is not repres

[C++] Implement D1957R0, T* to bool should be considered narrowing.

2019-11-10 Thread Jason Merrill
This paper was delayed until the February meeting in Prague so that we could get a better idea of what the impact on existing code would actually be. To that end, I'm implementing it now. Tested x86_64-pc-linux-gnu, applying to trunk. * typeck2.c (check_narrowing): Treat pointer->bool as

Re: [C++ PATCH] Fix deleted fn handling (PR c++/92447)

2019-11-11 Thread Jason Merrill
OK, thanks. On Mon, Nov 11, 2019 at 3:14 PM Jakub Jelinek wrote: > Hi! > > The finish_function change to goto cleanup; on DECL_DELETED_FN added > in the spaceship commit broke the following testcase. > The problem is that during start_preparsed_function push_nested_class > pushes a scope, but as

[C++ PATCH] Sorry about <=> on VECTOR_TYPE.

2019-11-11 Thread Jason Merrill
I'm not sure what semantics we might eventually want for vector <=>, but let's give a sorry for now. Tested x86_64-pc-linux-gnu, applying to trunk. --- gcc/cp/typeck.c | 7 +++ gcc/testsuite/g++.dg/cpp2a/spaceship-vec1.C | 11 +++ 2 files changed, 18 inse

Re: [C++ PATCH] Implement P1946R0 - Allow defaulting comparisons by value

2019-11-11 Thread Jason Merrill
ng to trunk. commit 0cbd94b2731032f1e0ec0a576f7b59cbcfded735 Author: Jason Merrill Date: Fri Nov 8 21:57:44 2019 + Implement P1946R0, Allow defaulting comparisons by value. * method.c (early_check_defaulted_comparison): Accept by-value, reject mix

Re: [C++] Fix interaction between aka changes and DR1558 (PR92206)

2019-11-12 Thread Jason Merrill
On 10/25/19 2:53 PM, Richard Sandiford wrote: One of the changes in r277281 was to make the typedef variant handling in strip_typedefs pass the raw DECL_ORIGINAL_TYPE to the recursive call, instead of applying TYPE_MAIN_VARIANT first. This PR shows that that interacts badly with the implementatio

Re: [PATCH 2/2] gdbinit.in: fix wrong reference to function argument

2019-11-13 Thread Jason Merrill
On Wed, Nov 13, 2019 at 6:39 AM Segher Boessenkool < seg...@kernel.crashing.org> wrote: > On Tue, Nov 12, 2019 at 04:17:17PM +0300, Konstantin Kharlamov wrote: > > On Вт, ноя 12, 2019 at 14:08, Andreas Schwab > > wrote: > > >On Nov 12 2019, Konstantin Kharlamov wrote: > > >> I'm definitely missin

Re: [C++ PATCH] c++/89070 - bogus [[nodiscard]] warning in SFINAE.

2019-11-13 Thread Jason Merrill
OK. On Tue, Nov 12, 2019 at 11:45 AM Marek Polacek wrote: > This is a complaint that we issue a [[nodiscard]] warning even in SFINAE > contexts. Here 'complain' is tf_decltype, but not tf_warning so I guess > we can fix it as below. > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > >

Re: [PATCH PR92926]Fix wrong code caused by ctor node translation unit wide sharing

2020-01-09 Thread Jason Merrill
On 1/9/20 3:59 AM, Jakub Jelinek wrote: On Thu, Jan 09, 2020 at 02:20:23PM +0800, Bin.Cheng wrote: On December 20, 2019 2:13:47 AM GMT+01:00, "Bin.Cheng" wrote: On Fri, Dec 13, 2019 at 11:26 AM bin.cheng wrote: Hi, As reported in PR92926, constant ctor is shared translation unit wide bec

Re: [PATCH PR92926]Fix wrong code caused by ctor node translation unit wide sharing

2020-01-09 Thread Jason Merrill
On 1/9/20 4:37 PM, Jakub Jelinek wrote: On Thu, Jan 09, 2020 at 04:27:09PM -0500, Jason Merrill wrote: Isn't the right spot to fix this somewhere in cp_gimplify_expr? I mean, the way gimplification works, we unshare_body first and then gimplify, which is destructive for the GENERIC

[RFC c-common PATCH] PR c++/40752 - useless -Wconversion with short +=.

2020-01-10 Thread Jason Merrill
afe_conversion_p back into conversion_warning with the others. rshift.diff restores the short_shift code to the C++ front end so that C and C++ give the same warnings with -Warith-conversion. Tested x86_64-pc-linux-gnu. Comments? commit 77b31408e3de8178f20972744d06501adb6ea961 Author: Jason M

[PATCH] PR c++/93173 - incorrect tree sharing.

2020-01-10 Thread Jason Merrill
My patch for 93033 wasn't sufficient to handle all the possible sharing introduced by split_nonconstant_init, and it occurred to me that it would make sense to use the same unsharing technique as unshare_body, namely copy_if_shared. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/93

[C++ PATCH] PR c++/93143 - incorrect tree sharing with constexpr.

2020-01-10 Thread Jason Merrill
We don't unshare CONSTRUCTORs as often during constexpr evaluation, so we need to unshare them here. Many thanks to bin cheng for the analysis and initial patch. Tested x86_64-pc-linux-gnu, applying to trunk. * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume CONSTRUC

[C++ PATCH RFC] PR c++/80265 - constexpr __builtin_mem*.

2020-01-10 Thread Jason Merrill
The library has already worked around this issue, but I was curious about why it wasn't working. The answer: because we were passing &var to fold, which doesn't know about the constexpr values hash table. Fixed by passing &"str" instead. Tested x86_64-pc-linux-gnu. Does this seem useful even th

[RFA (gimplify) PATCH] PR c++/33799 - destroy return value if local cleanup throws.

2020-01-10 Thread Jason Merrill
This is a pretty rare situation since the C++11 change to make all destructors default to noexcept, but it is still possible to define throwing destructors, and if a destructor for a local variable throws during the return, we've already constructed the return value, so now we need to destroy it.

Re: [wwwdocs] Git transition - how to access private user and vendor branches

2020-01-12 Thread Jason Merrill
On 1/11/20 10:54 AM, Richard Earnshaw (lists) wrote: On 11/01/2020 15:41, Segher Boessenkool wrote: Hi Richard, On Thu, Jan 09, 2020 at 04:50:03PM +, Richard Earnshaw (lists) wrote: Given the proposed intention to use non-standard refspecs for private and vendor branches I've written some

Re: [C++ PATCH RFC] PR c++/80265 - constexpr __builtin_mem*.

2020-01-13 Thread Jason Merrill
On Mon, Jan 13, 2020 at 6:11 AM Jonathan Wakely wrote: > On 11/01/20 00:03 -0500, Jason Merrill wrote: > >The library has already worked around this issue, but I was curious about > >why it wasn't working. The answer: because we were passing &var to fold, > &g

Re: [PATCH 0/2] Make C front end share the C++ tree representation of loops and switches

2020-01-13 Thread Jason Merrill
On 12/12/19 3:44 PM, Jason Merrill wrote: On Wed, Dec 11, 2019 at 1:37 PM Jeff Law <mailto:l...@redhat.com>> wrote: On Wed, 2019-12-11 at 00:03 -0700, Sandra Loosemore wrote: > On 12/6/19 3:41 PM, Jeff Law wrote: > > On Wed, 2019-11-13 at 09:27 -0700, Sand

[PATCH] PR c++/92582 - ICE with member template as requirement.

2020-01-13 Thread Jason Merrill
Here, we weren't recognizing that the template parameter of A is used by the reference to d in the requires-clause of f. Fixed by passing down the active template parameters in the context of normalization, and adding to the mapping any such parameters shared by a member template used in the const

[PATCH] PR c++/92746 - ICE with noexcept of function concept check.

2020-01-13 Thread Jason Merrill
Another place that needs to specially handle Concepts TS function-style concepts. Tested x86_64-pc-linux-gnu, applying to trunk. * except.c (check_noexcept_r): Handle concept-check. --- gcc/cp/except.c | 2 ++ gcc/testsuite/g++.dg/concepts/fn-concept3.C | 6 ++

[PATCH] Fix dejagnu pruning of constexpr context messages.

2020-01-14 Thread Jason Merrill
I wonder why nobody fixed this until now; it's been two years since the diagnostic context output was changed. Tested x86_64-pc-linux-gnu, applying to trunk. * lib/prune.exp (prune_gcc_output): Adjust constexpr pattern. --- gcc/testsuite/lib/prune.exp | 2 +- 1 file changed, 1 insertion(

[C++ PATCH] PR c++/92009 - ICE with punning of typeid.

2020-01-14 Thread Jason Merrill
There were two issues in this PR: 1) We were crashing in is_really_empty_class because we say that the internal RTTI types are classes, but never gave them TYPE_BINFO. 2) We were allowing the cast to a different pointer type because STRIP_NOPS in cxx_fold_indirect_ref ignored REINTERPRET_CAST_P.

[C++ PATCH] PR c++/92594 - ICE with inherited trivial default ctor.

2020-01-14 Thread Jason Merrill
Here we were getting confused about whether or not pod_tuple has a trivial default constructor. bar inherits the trivial e default constructor; the effect of calling that inherited constructor is equivalent to calling a defaulted default constructor in bar, so let's treat it as such. Tested x86_6

Re: [PR90916] ICE in retrieve specialization

2020-01-14 Thread Jason Merrill
On 1/14/20 2:14 PM, Nathan Sidwell wrote: + if (tree ti = (TREE_CODE (fn) == TYPE_DECL && !TYPE_DECL_ALIAS_P (fn) +? TYPE_TEMPLATE_INFO (TREE_TYPE (fn)) +: DECL_TEMPLATE_INFO (fn))) Is there a reason not to use get_template_info? Jason

[C++ PATCH] PR c++/92590 - wrong handling of inherited default ctor.

2020-01-14 Thread Jason Merrill
I thought my earlier fix for 91930 was an obvious bug fix, but apparently an inherited constructor does not count as user-declared. So this patch reverts that change and the other follow-on patches, and fixes 91930 differently, by not letting the inherited default constructor hide the implicitly-d

[C++ PATCH] PR c++/92871 - bad code with xvalue and GNU ?: extension.

2020-01-15 Thread Jason Merrill
I steered Jakub wrong on the desired behavior for temp-extend1.C in the context of bug 92831; it doesn't make sense to try to extend the lifetime of a temporary that we've already materialized to evaluate the test. So this patch munges the stabilized expression so that it won't be subject to lifet

[C++ PATCH] PR c++/93257 - consteval void function.

2020-01-15 Thread Jason Merrill
A prvalue can have void type, and if it doesn't do anything prohibited in a constant expression, it's vacuously constant. Tested x86_64-pc-linux-gnu, applying to trunk. * constexpr.c (verify_constant): Allow void_node. --- gcc/cp/constexpr.c | 3 ++- gcc/testsu

Re: [RFA (gimplify) PATCH] PR c++/33799 - destroy return value if local cleanup throws.

2020-01-15 Thread Jason Merrill
On 1/11/20 12:12 AM, Jason Merrill wrote: This is a pretty rare situation since the C++11 change to make all destructors default to noexcept, but it is still possible to define throwing destructors, and if a destructor for a local variable throws during the return, we've already constructe

Re: [patch] contrib: Don't add push rules for personal and vendor spaces.

2020-01-16 Thread Jason Merrill
On Wed, Jan 15, 2020 at 5:56 PM Joseph Myers wrote: > A reasonable replacement for those push rules might be command aliases > (e.g. "git upush " to push the user branch ). > And/or git mpush for push origin HEAD:master Jason

[C++ PATCH] PR c++/93280 - ICE with aggregate assignment and DMI.

2020-01-16 Thread Jason Merrill
I recently added an assert to cp-gimplify to catch any TARGET_EXPR_DIRECT_INIT_P being expanded without a target object, and this testcase found one. We started out with a TARGET_EXPR around the CONSTRUCTOR, which would normally mean that the member initializer would be used to directly initialize

[C++ PATCH] PR c++/93286 - ICE with __is_constructible and variadic template.

2020-01-16 Thread Jason Merrill
Here we had been recursing in tsubst_copy_and_build if type2 was a TREE_LIST because that function knew how to deal with pack expansions, and tsubst didn't. But tsubst_copy_and_build expects to be dealing with expressions, so we crash when trying to convert_from_reference a type. Tested x86_64-pc

Re: [PATCH] Fix ICE caused by swallowing a token in c_parser_consume_token

2020-01-17 Thread Jason Merrill
On 12/30/19 3:51 PM, Kerem Kat wrote: +/* { dg-message "expected" "expected" { target *-*-* } .3 } */ Dejagnu doesn't like this: ERROR: c-c++-common/pr92833-4.c -std=c++98: expected integer but got ".3" for " dg-message 4 "expected" "expected" { target *-*-* } .3 " Jason

Re: [C++ PATCH] Fix deprecated attribute handling on templates (PR c++/93228)

2020-01-17 Thread Jason Merrill
On 1/10/20 3:28 PM, Jakub Jelinek wrote: Hi! As the following testcase shows, when deprecated attribute is on a template, we'd never print the message if any, because the attribute is not present on the TEMPLATE_DECL with which warn_deprecated_use is called, but on its DECL_TEMPLATE_RESULT or it

[C++ PATCH] PR c++/92531 - ICE with noexcept(lambda).

2020-01-17 Thread Jason Merrill
This was failing because uses_template_parms didn't recognize LAMBDA_EXPR as a kind of expression. Instead of trying to enumerate all the different varieties of expression and then aborting if what's left isn't error_mark_node, let's handle error_mark_node and then assume anything else is an expre

Re: limit on emails for merge commits.

2020-01-17 Thread Jason Merrill
On 1/17/20 9:22 AM, Joseph Myers wrote: On Fri, 17 Jan 2020, Joel Brobecker wrote: The main goal of the limit is really to avoid accidents where someone pushes something he shouldn't or something he didn't realize would push so many commits. If the GCC repository is such that merges of 100 comm

[C++ PATCH] Simplify lambda parsing.

2020-01-19 Thread Jason Merrill
Since we removed the special parsing for C++11 lambdas, it's just been an open-coded copy of cp_parser_function_body. So let's call it instead. This avoids the need to change this code in my revised 33799 patch. Tested x86_64-pc-linux-gnu, applying to trunk. * parser.c (cp_parser_lambda

[C++ PATCH] PR c++/33799 - destroy return value, take 2.

2020-01-19 Thread Jason Merrill
This patch differs from the reverted patch for 33799 in that it adds the CLEANUP_STMT for the return value at the end of the function, and only if we've seen a cleanup that might throw, so it should not affect most C++11 code. Tested x86_64-pc-linux-gnu, applying to trunk. * cp-tree.h (cu

[PATCH] PR c++/91476 - anon-namespace reference temp clash between TUs.

2020-01-21 Thread Jason Merrill
The problem in the PR was that make_temporary_var_for_ref_to_temp ran before determine_visibility, so when we copied the linkage of the reference variable it had not yet been restricted by its anonymous namespace context, so the temporary wrongly ended up with TREE_PUBLIC set. The natural solution

Re: [PATCH] PR c++/91476 - anon-namespace reference temp clash between TUs.

2020-01-21 Thread Jason Merrill
On 1/21/20 10:17 AM, Jason Merrill wrote: The problem in the PR was that make_temporary_var_for_ref_to_temp ran before determine_visibility, so when we copied the linkage of the reference variable it had not yet been restricted by its anonymous namespace context, so the temporary wrongly ended

Re: [PATCH, v2] wwwdocs: e-mail subject lines for contributions

2020-01-21 Thread Jason Merrill
On 1/21/20 10:40 AM, Richard Earnshaw (lists) wrote: On 21/01/2020 15:39, Jakub Jelinek wrote: On Tue, Jan 21, 2020 at 03:33:22PM +, Richard Earnshaw (lists) wrote: Some examples would be useful I'd say, e.g. it is unclear in what way you want the PR number to be appended, shall it be some

[COMMITTED] PR c++/90732 - ICE with VLA capture and generic lambda.

2020-01-21 Thread Jason Merrill
We were failing to handle VLA capture in tsubst_lambda_expr; initially building a DECLTYPE_TYPE for the capture and then tsubsting it doesn't give the special VLA handling. So with this patch we call add_capture again for VLAs. Tested x86_64-pc-linux-gnu, applying to trunk. * pt.c (tsubs

[COMMITTED] PR c++/60855 - ICE with sizeof VLA capture.

2020-01-21 Thread Jason Merrill
For normal captures we usually look through them within unevaluated context, but that doesn't work here; trying to take the sizeof of the array in the enclosing scope tries and fails to evaluate a SAVE_EXPR from the enclosing scope. Tested x86_64-pc-linux-gnu, applying to trunk. * lambda.

Re: [PATCH] Fix a couple of memory leaks in the C++ frontend

2020-01-21 Thread Jason Merrill
On 1/20/20 8:06 PM, Patrick Palka wrote: The leak in get_mapped_args is due to auto_vec not properly supporting destructible elements, in that auto_vec's destructor doesn't call the destructors of its elements. Hmm, perhaps vec should static_assert __is_trivial(T) when supported. @@ -15344,6

Re: [C++ PATCH v2] PR c++/93324 - ICE with -Wall on constexpr if.

2020-01-21 Thread Jason Merrill
On 1/19/20 4:18 PM, Marek Polacek wrote: On Sun, Jan 19, 2020 at 10:00:42PM +0100, Jakub Jelinek wrote: On Sun, Jan 19, 2020 at 03:34:48PM -0500, Marek Polacek wrote: Bootstrapped/regtested on x86_64-linux, ok for trunk? * semantics.c (is_std_constant_evaluated_p): Check fndecl.

Re: [C++ PATCH] PR c++/92907 - noexcept does not consider "const" in member functions.

2020-01-21 Thread Jason Merrill
On 1/21/20 9:08 PM, Marek Polacek wrote: Here the problem is that if the noexcept specifier is used in the context of a const member function, const is not considered for the member variables, leading to a bogus error. g's const makes its 'this' const, so the first overload of f should be select

Re: [C++ Patch] PR 92804 [10 Regression] ICE trying to use concept as a nested-name-specifier

2020-01-22 Thread Jason Merrill
On 1/22/20 10:22 AM, Paolo Carlini wrote: Hi, in this simple issue we either wrongly talked about variable template-id in c++17 mode or ICEd in c++2a. I think we simply want to handle concept-ids first, both as represented in c++17 mode and as represented in c++2a mode. Tested x86_64-linux.

Re: [C++ PATCH v2] PR c++/92907 - noexcept does not consider "const" in member functions.

2020-01-22 Thread Jason Merrill
On 1/22/20 11:33 AM, Marek Polacek wrote: Here's what I did. Unfortunately it doesn't fix PR79620. No, I wouldn't expect it to, that looks like more of an issue with how is_lambda_ignored_entity skips captures in unevaluated context. + cp_cv_quals quals; + if (DECL_NONSTATIC_MEMBER_FUNCT

Re: [PATCH] Fix a couple of memory leaks in the C++ frontend

2020-01-22 Thread Jason Merrill
On 1/22/20 11:19 AM, Patrick Palka wrote: On Tue, 21 Jan 2020, Jason Merrill wrote: On 1/20/20 8:06 PM, Patrick Palka wrote: The leak in get_mapped_args is due to auto_vec not properly supporting destructible elements, in that auto_vec's destructor doesn't call the destructors of it

Re: [RFC c-common PATCH] PR c++/40752 - useless -Wconversion with short +=.

2020-01-22 Thread Jason Merrill
On 1/22/20 5:14 AM, Martin Liška wrote: Hi. Just for the record, after the change 526.blender_r fails due to: blender/source/blender/blenlib/intern/math_color.c: In function 'rgb_float_to_uchar': blender/source/blender/blenlib/BLI_utildefines.h:251:22: error: conversion from 'float' to 'unsig

Re: [C++ Patch] PR 92804 [10 Regression] ICE trying to use concept as a nested-name-specifier

2020-01-22 Thread Jason Merrill
On 1/22/20 3:31 PM, Paolo Carlini wrote: Hi, On 22/01/20 17:27, Jason Merrill wrote: On 1/22/20 10:22 AM, Paolo Carlini wrote: Hi, in this simple issue we either wrongly talked about variable template-id in c++17 mode or ICEd in c++2a. I think we simply want to handle concept-ids first

Re: [RFC c-common PATCH] PR c++/40752 - useless -Wconversion with short +=.

2020-01-22 Thread Jason Merrill
On 1/22/20 1:20 PM, Jason Merrill wrote: On 1/22/20 5:14 AM, Martin Liška wrote: Hi. Just for the record, after the change 526.blender_r fails due to: blender/source/blender/blenlib/intern/math_color.c: In function 'rgb_float_to_uchar': blender/source/blender/blenlib/BLI_utildefine

Re: [RFC c-common PATCH] PR c++/40752 - useless -Wconversion with short +=.

2020-01-23 Thread Jason Merrill
On 1/22/20 5:58 PM, Jason Merrill wrote: On 1/22/20 1:20 PM, Jason Merrill wrote: On 1/22/20 5:14 AM, Martin Liška wrote: Hi. Just for the record, after the change 526.blender_r fails due to: blender/source/blender/blenlib/intern/math_color.c: In function 'rgb_float_to_uchar'

[COMMITTED] c++: Fix ICE with defaulted dtor and template (PR93345)

2020-01-23 Thread Jason Merrill
In a template we don't instantiate a deferred noexcept-spec, and we don't need it because we aren't going to do anything with the value of throwing_cleanup in a template anyway. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/93345 - ICE with defaulted dtor and template. PR

[COMMITTED] c++: Avoid ICE when constexpr __builtin_strchr fails.

2020-01-23 Thread Jason Merrill
If we can't change the argument to &"...", use the original arg instead of the partially munged one. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/93331 - ICE with __builtin_strchr. * constexpr.c (cxx_eval_builtin_function_call): Use the original argument if we did

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