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

2020-01-23 Thread Jason Merrill
On 1/23/20 4:31 AM, Paolo Carlini wrote: Hi, On 22/01/20 22:32, Jason Merrill wrote: 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

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

2020-01-24 Thread Jason Merrill
On 1/24/20 8:45 AM, David Edelsohn wrote: There is no ChangeLog entry for the testsuite changes. I don't believe in ChangeLog entries for testcases, but I'll add one for the target-supports.exp change, thanks. I'm also still trying to determine if Wconversion-pr40752.c requires -fsigned-cha

Re: [C++ PATCH] PR c++/93299 - ICE in tsubst_copy with parenthesized expression.

2020-01-24 Thread Jason Merrill
On 1/17/20 4:03 PM, Marek Polacek wrote: Since e4511ca2e9ecdb51d41b64452398f8e2df575668 force_paren_expr can create a VIEW_CONVERT_EXPR so that we have something to set REF_PARENTHESIZED_P on, while not making the expression dependent. But tsubst_copy can't cope with such a VIEW_CONVERT_EXPR, be

[COMMITTED] c++: Unshare expressions from constexpr cache.

2020-01-24 Thread Jason Merrill
Another place we need to unshare cached expressions. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/92852 - ICE with generic lambda and reference var. * constexpr.c (maybe_constant_value): Likewise. --- gcc/cp/constexpr.c | 2 +- gcc/testsuit

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

2020-01-24 Thread Jason Merrill
On Fri, Jan 24, 2020 at 12:46 PM David Edelsohn wrote: > On Fri, Jan 24, 2020 at 12:00 PM Jason Merrill wrote: > > > > On 1/24/20 8:45 AM, David Edelsohn wrote: > > > There is no ChangeLog entry for the testsuite changes. > > > > I don't believe in Chan

[COMMITTED] c++: Fix parameter map handling of member typedef.

2020-01-24 Thread Jason Merrill
any_template_parm_r was looking at the args of an alias template-id, but we need to look at all args of a member alias/typedef, including implicit ones from the enclosing class. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/93377 - ICE with member alias in constraint. * pt

[COMMITTED] c++: Fix ICE with lambda in member operator (PR93279)

2020-01-24 Thread Jason Merrill
Here the problem was that we were remembering the lookup in template scope, and then trying to reuse that lookup in the instantiation without substituting into it at all. The simplest solution is to not try to remember a lookup that finds a class-scope declaration, as in that case doing the normal

Re: [C++ PATCH] c++: Poor diagnostic for dynamic_cast in constexpr context [PR93414]

2020-01-24 Thread Jason Merrill
[C++ PATCH] c++: is unnecessarily redundant, you can just write [PATCH]. On 1/24/20 6:20 PM, Marek Polacek wrote:> I neglected to add a proper diagnostic for the reference dynamic_cast> case when the operand of a dynamic_cast doesn't refer to a public base> of Derived, resulting in suboptimal

[COMMITTED] c++: Fix ICE with constrained friend (PR93400).

2020-01-24 Thread Jason Merrill
Here, the problem was that tsubst_friend_function was modifying the CONSTRAINT_INFO for the friend template to have the constraints for one instantiation, which fell down when we went to adjust it for another instantiation. Fixed by deferring substitution of trailing requirements until we try to c

[PATCH] checking: avoid verify_type_variant crash on incomplete type.

2020-01-25 Thread Jason Merrill
Here, we end up calling gen_type_die_with_usage for a type that's in the middle of finish_struct_1, after we set TYPE_NEEDS_CONSTRUCTING on it but before we copy all the flags to the variants--and, significantly, before we set its TYPE_SIZE. It seems reasonable to only look at TYPE_NEEDS_CONSTRUCT

[COMMITTED] c++: avoid ICE with __builtin_memset (PR90997).

2020-01-25 Thread Jason Merrill
warn_for_memset calls fold_for_warn, which calls fold_non_dependent_expr, so also calling instantiate_non_dependent_expr here is undesirable. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/90997 * semantics.c (finish_call_expr): Don't call instantiate_non_dependent_

[COMMITTED] c++: Fix -Wnoexcept handling of system headers (PR90992).

2020-01-26 Thread Jason Merrill
The immediate issue here was that the second warning didn't depend on the first one, so if the first location was in a system header, we'd mysteriously give the second by itself. It's also the case that the thing we care about being in a system header is the function that we want to suggest adding

[COMMITTED] c++: Fix array of char typedef in template (PR90966).

2020-01-27 Thread Jason Merrill
Since Martin Sebor's patch for PR 71625 to change braced array initializers to STRING_CST in some cases, we need to be ready for STRING_CST with types that are changed by tsubst. fold_convert doesn't know how to deal with STRING_CST, which is reasonable; we really shouldn't expect it to here. So

[PATCH] c++: Function declared with typedef with eh-specification.

2020-01-28 Thread Jason Merrill
We just need to handle the exception specification like other properties of a function typedef. Tested x86_64-pc-linux-gnu, applying to trunk/9. PR c++/90731 * decl.c (grokdeclarator): Propagate eh spec from typedef. --- gcc/cp/decl.c| 1 + gcc/tes

[COMMITTED] c++: Allow template rvalue-ref conv to bind to lvalue ref.

2020-01-28 Thread Jason Merrill
When I implemented the [over.match.ref] rule that a reference conversion function needs to match l/rvalue of the target reference type it changed our handling of this testcase. It seems to me that our current behavior is what the standard says, but it doesn't seem desirable, and all the other comp

[COMMITTED] c++: Fix guard variable and attribute weak.

2020-01-28 Thread Jason Merrill
My patch for PR 91476 worked for decls that are implicitly comdat/weak due to C++ linkage rules, but broke variables explicitly marked weak. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/93477 PR c++/91476 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WE

[COMMITTED] c++: Fix return deduction of lambda in discarded stmt.

2020-01-28 Thread Jason Merrill
A return statement in a discarded statement is not used for return type deduction, but we still want to do deduction for a return statement in a lambda in a discarded statement. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/93442 * parser.c (cp_parser_lambda_expression): C

Re: [C++ Patch] PR 90915 [9/10 Regression] ICE in has_attribute, at c-family/c-attribs.c:4221

2020-01-29 Thread Jason Merrill
On 1/29/20 4:31 AM, Paolo Carlini wrote: Hi, in this regression we issue a diagnostic about an incomplete type (only a warning by default) and then we crash when we try to query has_attribute on a member of the type because in such cases the member remains an IDENTIFIER_NODE which of course d

Re: [PATCH] c++: Fix class NTTP with template arguments [PR92948]

2020-01-29 Thread Jason Merrill
On 1/28/20 6:34 PM, Marek Polacek wrote: This PR points out an ICE with an alias template and class NTTP, but I found that there are more issues. Trouble arise when we use a (non-type) template parameter as an argument to the template arg list of a template that accepts a class NTTP and a conver

Re: [PATCH] c++: Fix template arguments comparison with class NTTP [PR91754]

2020-01-29 Thread Jason Merrill
On 1/29/20 12:35 PM, Marek Polacek wrote: Here we fail to compile the attached test, stating that the use of T in T::T() {} is "invalid use of incomplete type". It is a function definition so grokdeclarator checks that the qualifying type is complete. When we parsed the class T, finish_struct g

[COMMITTED] c++: Fix attributes with lambda and trailing return type.

2020-01-29 Thread Jason Merrill
My fix for 60503 fixed handling of C++11 attributes following the lambda-declarator. My patch for 89640 re-added support for GNU attributes, but attributes after the trailing return type were parsed as applying to the return type rather than to the function. This patch adjusts parsing of a traili

[COMMITTED] c++: Drop alignas restriction for stack variables.

2020-01-29 Thread Jason Merrill
Since expand_stack_vars and such know how to deal with variables aligned beyond MAX_SUPPORTED_STACK_ALIGNMENT, we shouldn't reject alignas of large alignments. And if we don't do that, there's no point in having check_cxx_fundamental_alignment_constraints at all, since check_user_alignment already

[COMMITTED] c++: Fix -Wtype-limits in templates.

2020-01-30 Thread Jason Merrill
When instantiating a template tsubst_copy_and_build suppresses -Wtype-limits warnings about e.g. == always being false because it might not always be false for an instantiation with other template arguments. But we should warn if the operands don't depend on template arguments. I also tried givin

[COMMITTED 1/2] c++: Reduce memory consumption for large static arrays.

2020-01-31 Thread Jason Merrill
PR14179 and the C counterpart PR12245 are about memory consumption of very large file-scope arrays. Recently, location wrappers increased memory consumption significantly: in an array of integer constants, each one will have a location wrapper, which added up to over 500MB in the 14179 testcase.

[COMMITTED 2/2] c++: Reduce memory consumption for arrays of non-aggregate type.

2020-01-31 Thread Jason Merrill
The remaining low-hanging fruit for improvement on memory consumption in the 14179 testcase was the duplication of the CONSTRUCTOR for the array by reshape_init. This patch changes reshape_init to reuse a single constructor for an array of non-aggregate type such as the one in the testcase. Teste

[COMMITTED] c++: Fix sizeof VLA lambda capture.

2020-01-31 Thread Jason Merrill
sizeof a VLA type is not a constant in C or the GNU C++ extension, so we need to capture the VLA even in unevaluated context. For PR60855 we stopped looking through a previous capture, but we also need to capture the first time the variable is mentioned. Tested x86_64-pc-linux-gnu, applying to tr

Re: [PATCH] c++: Fix ICE on invalid alignas in a template [PR93530]

2020-02-02 Thread Jason Merrill
On 1/31/20 8:06 PM, Marek Polacek wrote: This fixes an ICE taking place in cp_default_conversion because we got a SCOPE_REF that doesn't have a type and so checking INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (exp)) will crash. This happens since the recent Joseph's change in decl_attribut

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

2020-02-03 Thread Jason Merrill
On Mon, Feb 3, 2020 at 7:57 AM Alexander Monakov wrote: > On Mon, 3 Feb 2020, Richard Earnshaw (lists) wrote: > > > Upper case is what glibc has, though it appears that it's a rule that is > not > > strictly followed. If we change it, then it becomes another friction > point > > between develope

[COMMITTED] c++: Fix cast to pointer to VLA.

2020-02-03 Thread Jason Merrill
The C front-end fixed this issue in r257620 by adding a DECL_EXPR from grokdeclarator. We don't have an easy way to do that in the C++ front-end, but it works fine to create and prepend a DECL_EXPR when we are genericizing the NOP_EXPR for the cast. The C patch wraps the DECL_EXPR in a BIND_EXPR,

[COMMITTED 2/2] c++: Fix constexpr vs. reference parameter.

2020-02-03 Thread Jason Merrill
[expr.const] specifically rules out mentioning a reference even if its address is never used, because it implies indirection that is similarly non-constant for a pointer variable. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/66477 * constexpr.c (cxx_eval_constant_expressi

[COMMITTED 1/2] c++: Allow parm of empty class type in constexpr.

2020-02-03 Thread Jason Merrill
Since copying a class object is defined in terms of the copy constructor, copying an empty class is OK even if it would otherwise not be usable in a constant expression. Relatedly, using a parameter as an lvalue is no more problematic than a local variable, and calling a member function uses the o

[COMMITTED] c++: Fix ({ ... }) array mem-initializer.

2020-02-04 Thread Jason Merrill
Here, we were going down the wrong path in perform_member_init because of the incorrect parens around the mem-initializer for the array. And then cxx_eval_vec_init_1 didn't know what to do with a CONSTRUCTOR as the initializer. The latter issue was a straightforward fix, but I also wanted to fix

[COMMITTED] c++: Fix constexpr vs. omitted aggregate init.

2020-02-04 Thread Jason Merrill
Value-initialization is importantly different from {}-initialization for this testcase, where the former calls the deleted S constructor and the latter initializes S happily. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/90951 * constexpr.c (cxx_eval_array_reference): {}-i

[COMMITTED] c++: Fix error-recovery with concepts.

2020-02-04 Thread Jason Merrill
Here, push_tinst_level refused to push into the scope of Foo::Foo because it was triggered from the ill-formed function fun. But we didn't check the return value and tried to pop the un-pushed level. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/93551 * constraint.cc (sat

Re: [PATCH] c++: Mark __builtin_convertvector operand as read [PR93557]

2020-02-05 Thread Jason Merrill
On 2/5/20 5:44 AM, Jakub Jelinek wrote: Hi! In C++ we weren't calling mark_exp_read on the __builtin_convertvector first argument. I guess it could misbehave even with lambda implicit captures. Fixed by calling decay_conversion on the argument, we use the argument as rvalue so we want the stan

Re: [PATCH] c++: Handle CONSTRUCTORs without indexes in find_array_ctor_elt [PR93549]

2020-02-05 Thread Jason Merrill
On 2/4/20 4:20 AM, Jakub Jelinek wrote: Hi! My change * typeck2.c (store_init_value): Don't call cp_fully_fold_init on initializers of automatic non-constexpr variables in constexpr functions. - value = cp_fully_fold_init (value); + /* Don't fold initializers of automatic variables in constexp

[COMMITTED] c++: Fix SEGV with malformed constructor decl.

2020-02-05 Thread Jason Merrill
In the testcase, since there's no declaration of T, ref_view(T) declares a non-static data member T of type ref_view, the same type as its enclosing class. Then when we try to do C++20 aggregate class template argument deduction we recursively try to adjust the braced-init-list to match the templa

[PATCH RFA] cgraph: A COMDAT decl always has non-zero address.

2020-02-05 Thread Jason Merrill
We should be able to assume that a template instantiation or other COMDAT has non-zero address even if MAKE_DECL_ONE_ONLY for the target sets DECL_WEAK and we haven't yet decided to emit a definition in this translation unit. Tested x86_64-pc-linux-gnu, OK for trunk? PR c++/92003

Re: [PATCH] c++: Fix ICE with CONSTRUCTOR flags verification [PR93559]

2020-02-05 Thread Jason Merrill
On Wed, Feb 5, 2020 at 4:18 PM Marek Polacek wrote: > Since reshape_init_array_1 can now reuse a single constructor for > an array of non-aggregate type, we might run into a scenario where > we reuse a constructor with TREE_SIDE_EFFECTS. This broke this test > because we have something like { {

Re: [PATCH] c++: Fix ICE with lambda in operator function [PR93597]

2020-02-05 Thread Jason Merrill
On 2/5/20 4:31 PM, Marek Polacek wrote: If we are going to use get_first_fn let's make sure we operate on is_overloaded_fn, as the rest of the codebase does. Bootstrapped/regtested on x86_64-linux, ok for trunk? PR c++/93597 - ICE with lambda in operator function. * name-lookup.

[COMMITTED] c++: Fix decltype of empty pack expansion of parm.

2020-02-05 Thread Jason Merrill
In unevaluated context, we only substitute a single PARM_DECL, not the entire chain, but the handling of an empty pack expansion was missing that check. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/93140 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in

Re: [PATCH v2] c++: Fix ICE with lambda in operator function [PR93597]

2020-02-05 Thread Jason Merrill
On 2/5/20 5:04 PM, Marek Polacek wrote: On Wed, Feb 05, 2020 at 04:40:50PM -0500, Jason Merrill wrote: On 2/5/20 4:31 PM, Marek Polacek wrote: If we are going to use get_first_fn let's make sure we operate on is_overloaded_fn, as the rest of the codebase does. Bootstrapped/regtested on x

Re: [PATCH] c++: Handle CONSTRUCTORs without indexes in find_array_ctor_elt [PR93549]

2020-02-06 Thread Jason Merrill
On Thu, Feb 6, 2020 at 7:02 AM Jakub Jelinek wrote: > On Wed, Feb 05, 2020 at 01:31:30PM -0500, Jason Merrill wrote: > > > from the constexpr new change apparently broke the following testcase. > > > When handling COND_EXPR, we build_vector_from_val, however as the > argu

[COMMITTED] c++: Fix ICE on nonsense requires-clause.

2020-02-07 Thread Jason Merrill
Here we were swallowing all the syntax errors by parsing tentatively, and returning error_mark_node without ever actually giving an error. Fixed by using save_tokens/rollback_tokens instead. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/92517 * parser.c (cp_parser_constra

[COMMITTED] c++: Fix use of local in constexpr if.

2020-02-07 Thread Jason Merrill
extract_local_specs wasn't finding the mention of 'an' as a template argument because we weren't walking into template arguments. So here I changed cp_walk_subtrees to do so--only walking into template arguments in the spelling of the type or expression, not any hidden behind typedefs. The change

Re: [PATCH] c++: Fix paren init of aggregates in unevaluated context [PR92947]

2020-02-07 Thread Jason Merrill
On 2/7/20 3:29 PM, Marek Polacek wrote: When I implemented C++20 parenthesized initialization of aggregates I introduced this bogus cp_unevaluated_operand check, thus disabling this feature in unevaluated context. Oop. Removing the check turned up another bug: I wasn't checking the return value

Re: [PATCH v2] c++: Handle CONSTRUCTORs without indexes in find_array_ctor_elt [PR93549]

2020-02-08 Thread Jason Merrill
On 2/8/20 5:14 AM, Jakub Jelinek wrote: Hi! On Thu, Feb 06, 2020 at 05:04:49PM +0100, Jakub Jelinek wrote: On Thu, Feb 06, 2020 at 10:38:25AM -0500, Jason Merrill wrote: I don't know, can try to add some instrumentation and do bootstrap/regtest with it. The handling of the CONSTRUCTORs

[COMMITTED] c++: Use constexpr to avoid wrong -Wsign-compare

2020-02-08 Thread Jason Merrill
decomp48.C. And the digest_init patch avoids a regression on desig14.C. All tested x86_64-pc-linux-gnu, applying to trunk. >From 00c458ede4df6ff37d709b8a8d3135e2aa4c9d14 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 26 Jan 2020 22:58:32 -0500 Subject: [PATCH 4/4] c++: Use constexpr t

Re: [PATCH] c++: Fix ICE during constexpr virtual call evaluation [PR93633]

2020-02-09 Thread Jason Merrill
On 2/9/20 2:27 AM, Jakub Jelinek wrote: Hi! The first (valid) testcase ICEs because for A *a = new B (); a->foo (); // virtual method call we actually see &heap and the "heap " objects don't have the class or whatever else type was used in new expression, but an array type containing one

Re: [PATCH] c++: Fix ICE with template codes in check_narrowing [PR91465]

2020-02-09 Thread Jason Merrill
On 2/6/20 7:30 PM, Marek Polacek wrote: In ed4f2c001a883b2456fc607a33f1c59f9c4ee65d I changed the call to fold_non_dependent_expr in check_narrowing to maybe_constant_value. That was the wrong thing to do as these tests show: check_narrowing bails out for dependent expressions but we can still ha

[COMMITTED] c++: Fix flexible array with synthesized constructor.

2020-02-10 Thread Jason Merrill
We were already rejecting initialization of a flexible array member in a constructor; we similarly shouldn't try to clean it up. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/93618 * tree.c (array_of_unknown_bound_p): New. * init.c (perform_member_init): Do nothing

Re: [COMMITTED] c++: Fix ICE on nonsense requires-clause.

2020-02-10 Thread Jason Merrill
On Mon, Feb 10, 2020 at 2:13 PM Christophe Lyon wrote: > On Fri, 7 Feb 2020 at 14:54, Jason Merrill wrote: > > > > Here we were swallowing all the syntax errors by parsing tentatively, and > > returning error_mark_node without ever actually giving an error. Fixed >

Re: [PATCH] c++: Improve dump_decl for standard concepts

2020-02-10 Thread Jason Merrill
On 2/10/20 5:28 PM, Patrick Palka wrote: This patch improves the pretty printing of standard concept definitions in error messages. In particular, standard concepts are now printed qualified whenever appropriate, and the "concept" specifier is printed only when the TFF_DECL_SPECIFIERS flag is sp

Re: [PATCH] c++: Fix return type deduction with an abbreviated function template

2020-02-10 Thread Jason Merrill
On 2/10/20 2:20 PM, Patrick Palka wrote: This patch fixes two issues with return type deduction in the presence of an abbreviated function template. The first issue (PR 69448) is that if a placeholder auto return type contains any modifiers such as & or *, then the abbreviated-function-template

Re: [PATCH] c++: Fix return type deduction with an abbreviated function template

2020-02-10 Thread Jason Merrill
On 2/10/20 8:21 PM, Patrick Palka wrote: On Mon, 10 Feb 2020, Jason Merrill wrote: On 2/10/20 2:20 PM, Patrick Palka wrote: This patch fixes two issues with return type deduction in the presence of an abbreviated function template. The first issue (PR 69448) is that if a placeholder auto

[committed] c++: Fix static initialization from <=>.

2020-02-11 Thread Jason Merrill
og 2020-02-11 Jason Merrill PR c++/93650 PR c++/90691 * constexpr.c (maybe_constant_value): Correct earlier change. (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through. * method.c (genericize_spaceship): Wrap result in TARGET_EXPR. --- gcc/cp/c

[committed] c++: Fix implicit friend operator==.

2020-02-11 Thread Jason Merrill
It seems that in writing testcases for the operator<=> proposal I didn't include any tests for implicitly declared friend operator==, and consequently it didn't work. Tested x86_64-pc-linux-gnu, applying to trunk. 2020-02-11 Jason Merrill PR c++/93675

Re: [PATCH] avoid user-constructible types in reshape_init_array (PR 90938)

2020-02-11 Thread Jason Merrill
On 2/11/20 9:00 PM, Martin Sebor wrote: r270155, committed in GCC 9, introduced a transformation that strips redundant trailing zero initializers from array initializer lists in order to support string literals as template arguments. The transformation neglected to consider the case of array ele

Re: [PATCH] c++: Fix ICE-on-invalid with broken attribute [PR93684]

2020-02-11 Thread Jason Merrill
On 2/11/20 10:35 PM, Marek Polacek wrote: We crash when parsing [[a:: because we see a CPP_SCOPE and then we're trying to consume a CPP_EOF token. So peek before consuming it. Bootstrapped/regtested on x86_64-linux, ok for trunk? OK. PR c++/93684 - ICE-on-invalid with broken at

[committed] c++: Fix constexpr if and braced functional cast.

2020-02-12 Thread Jason Merrill
ition. In this testcase our tree walk wasn't finding the use of i because we weren't walking into the type of a CONSTRUCTOR. Fixed by moving the code for doing that from find_parameter_packs_r into cp_walk_subtrees. Tested x86_64-pc-linux-gnu, applying to trunk. 2020-02-11 Jason Merril

[comitted] c++: Fix static local vars in extern "C".

2020-02-13 Thread Jason Merrill
standard. Tested x86_64-pc-linux-gnu, applying to trunk. gcc/cp/ChangeLog 2020-02-13 Jason Merrill PR c++/93643 PR c++/91476 * tree.c (decl_linkage): Always lk_none for locals. --- gcc/cp/tree.c | 9 +++ .../g++.dg/lookup/extern-c

[committed] c++: Fix useless using-declaration.

2020-02-13 Thread Jason Merrill
Here reintroducing the same declarations into the global namespace via using-declaration is useless but OK. And a function and a function template with the same parameters do not conflict. Tested x86_64-pc-linux-gnu, applying to trunk. gcc/cp/ChangeLog 2020-02-13 Jason Merrill PR c

Re: [PATCH] avoid user-constructible types in reshape_init_array (PR 90938)

2020-02-13 Thread Jason Merrill
On 2/12/20 9:21 PM, Martin Sebor wrote: On 2/11/20 5:28 PM, Jason Merrill wrote: On 2/11/20 9:00 PM, Martin Sebor wrote: r270155, committed in GCC 9, introduced a transformation that strips redundant trailing zero initializers from array initializer lists in order to support string literals as

Re: [PATCH] c++: Emit DFP typeinfos even when DFP is disabled [PR92906]

2020-02-13 Thread Jason Merrill
On 2/12/20 12:31 PM, Jakub Jelinek wrote: Hi! Before Joseph's changes when compiling libstdc++-v3/libsupc++/fundamental_type_info.cc we were emitting _ZTIPDd, _ZTIPDe, _ZTIPDf, _ZTIPKDd, _ZTIPKDe, _ZTIPKDf, _ZTIDd, _ZTIDe, _ZTIDf symbols even when DFP wasn't usable, but now we don't and thus tho

Re: [PATCH] c++: Fix hashing and testing for equality of ATOMIC_CONST_EXPRs

2020-02-13 Thread Jason Merrill
On 2/12/20 5:15 PM, Patrick Palka wrote: Two equal atomic constraint expressions do not necessarily share the same tree, so we can't assume that two ATOMIC_CONST_EXPRs are equal if and only if they point to the same tree. This is incorrect; comparison of atomic constraints is based on them com

Re: [PATCH] c++: Fix poor diagnostic for array initializer [PR93710]

2020-02-13 Thread Jason Merrill
On 2/12/20 9:05 PM, Marek Polacek wrote: A small improvement for an error in build_user_type_conversion_1: instead of array-init1.C:11:1: error: conversion from ‘long int’ to ‘A’ is ambiguous 11 | }; | ^ we will print array-init1.C:8:3: error: conversion from ‘long int’ to ‘A’ is am

Re: [PATCH] c++: Fix value-init crash in template [PR93676]

2020-02-13 Thread Jason Merrill
On 2/11/20 8:54 PM, Marek Polacek wrote: Since we attempt to value-initialize in build_vec_init even when there's no initializer but the type has a constexpr default constructor. But build_value_init doesn't work in templates, so I think

Re: [PATCH v2] c++: Fix ICE with template codes in check_narrowing [PR91465]

2020-02-13 Thread Jason Merrill
On 2/11/20 5:06 PM, Marek Polacek wrote: On Sun, Feb 09, 2020 at 01:51:13PM +0100, Jason Merrill wrote: On 2/6/20 7:30 PM, Marek Polacek wrote: In ed4f2c001a883b2456fc607a33f1c59f9c4ee65d I changed the call to fold_non_dependent_expr in check_narrowing to maybe_constant_value. That was the

Re: [PATCH] c++: Partially implement P1042R1: __VA_OPT__ wording clarifications [PR92319]

2020-02-13 Thread Jason Merrill
On 1/31/20 7:14 PM, Jakub Jelinek wrote: Hi! I've noticed we claim in cxx-status.html that we implement P1042R1, but it seems we don't implement any of the changes from there. The following patch implements just the change that __VA_OPT__ determines whether to expand to nothing or the enclosed t

Re: [PATCH] c++: Fix ICE with ill-formed array list-initialization [PR93712]

2020-02-14 Thread Jason Merrill
On 2/13/20 8:56 PM, Marek Polacek wrote: My P0388R4 patch changed build_array_conv to create an identity conversion at the start of the conversion chain. Hmm, an identity conversion of {} suggests that it has a type, which it doesn't in the language. I'm not strongly against it, but what was

Re: [PATCH] wwwdocs: P1042R1: mention only partial support [PR92319]

2020-02-14 Thread Jason Merrill
On 2/14/20 9:18 AM, Jakub Jelinek wrote: On Fri, Feb 14, 2020 at 08:41:45AM +0100, Jason Merrill wrote: I'm afraid I'm completely lost about the padding preservation/removal changes that are also in the paper, so haven't touched that part. For this, shall we mention the

Re: [committed] c++: Fix constexpr if and braced functional cast.

2020-02-15 Thread Jason Merrill
On 2/13/20 12:42 AM, Jason Merrill wrote: While partially instantiating a generic lambda, we can encounter pack expansions or constexpr if where we can't actually do the substitution immediately, and instead remember a partial instantiation context in *_EXTRA_ARGS. This include

[committed] c++: Fix lambda in atomic constraint [PR92556]

2020-02-15 Thread Jason Merrill
-02-15 Jason Merrill PR c++/92556 * pt.c (any_template_parm_r): Look into lambda body. --- gcc/cp/pt.c | 9 + gcc/testsuite/g++.dg/cpp2a/concepts-lambda5.C | 10 ++ 2 files changed, 19 insertions(+) create mode 100644 gcc

[committed] c++: Add -std=c++20.

2020-02-15 Thread Jason Merrill
g to trunk. gcc/ChangeLog 2020-02-15 Jason Merrill * doc/invoke.texi (C Dialect Options): Add -std=c++20. gcc/c-family/ChangeLog 2020-02-15 Jason Merrill * c.opt: Add -std=c++20. gcc/testsuite/ChangeLog 2020-02-15 Jason Merrill * lib/target-su

Re: [C++ Patch] Improve build_functional_cast locations

2019-12-04 Thread Jason Merrill
On 12/4/19 11:44 AM, Paolo Carlini wrote: Hi, this exemplifies in a compact way the kind of change we can implement for the other casts too: near the end of cp_parser_functional_cast instead of using the combined_loc only for the returned cp_expr we can also pass it to build_functional_cast.

Re: [PATCH] add -Wmismatched-tags (PR 61339)

2019-12-04 Thread Jason Merrill
On 12/3/19 4:49 PM, Martin Sebor wrote: On 8/5/19 4:30 PM, Jason Merrill wrote: On Mon, Aug 5, 2019 at 5:50 PM Martin Sebor wrote: On 8/5/19 1:25 PM, Jason Merrill wrote: On 8/1/19 7:35 PM, Martin Sebor wrote: On 8/1/19 12:09 PM, Jason Merrill wrote: On 7/22/19 12:34 PM, Martin Sebor

Re: [C++ PATCH] c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.

2019-12-05 Thread Jason Merrill
On 12/4/19 5:43 PM, Marek Polacek wrote: @@ -,12 +2243,24 @@ reduced_constant_expression_p (tree t) return false; if (field) { + retry: if (idx != field) - return false; + { + /* Empty class fi

Re: [C++ PATCH] c++/92271 - make __is_same alias for __is_same_as.

2019-12-05 Thread Jason Merrill
On 12/5/19 1:11 PM, Marek Polacek wrote: Richard Smith proposed adding a synonym for __is_same_as, to accomodate the convention of exposing std::SOME_TRAIT::value as __SOME_TRAIT(A, B). So add that alias, and also adjust the C++ printer. I didn't bother changing the RID_ identifier. Bootstrapp

Re: [C++ PATCH] c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.

2019-12-05 Thread Jason Merrill
On 12/5/19 2:28 PM, Marek Polacek wrote: On Thu, Dec 05, 2019 at 01:37:45PM -0500, Jason Merrill wrote: On 12/4/19 5:43 PM, Marek Polacek wrote: @@ -,12 +2243,24 @@ reduced_constant_expression_p (tree t) return false; if (field) { + retry

Re: Ping: [PATCH][C++] Pass type uses through the verify_type_context hook

2019-12-05 Thread Jason Merrill
On 12/5/19 1:21 PM, Richard Sandiford wrote: + else if (!verify_type_context (input_location, TCTX_EXCEPTIONS, type)) +return false; + + else if (TYPE_REF_P (type) + && !verify_type_context (input_location, TCTX_EXCEPTIONS, + TREE_TYPE (type))) Y

Re: [RFC] Characters per line: from punch card (80) to line printer (132) (was: [Patch][OpenMP/OpenACC/Fortran] Fix mapping of optional (present|absent) arguments)

2019-12-05 Thread Jason Merrill
On Thu, Dec 5, 2019 at 11:51 AM Michael Matz wrote: > Hello, > > (oh a flame bait :) ) > > On Thu, 5 Dec 2019, Thomas Schwinge wrote: > > > So, I formally propose that we lift this characters per line restriction > > from IBM punch card (80) to mainframe line printer (132). > > > > Tasks: > > > >

Re: Ping: [PATCH][C++] Pass type uses through the verify_type_context hook

2019-12-06 Thread Jason Merrill
On 12/6/19 9:26 AM, Richard Sandiford wrote: Jason Merrill writes: On 12/5/19 1:21 PM, Richard Sandiford wrote: + else if (!verify_type_context (input_location, TCTX_EXCEPTIONS, type)) +return false; + + else if (TYPE_REF_P (type) + && !verify_type_context (input_

Re: [C++ Patch] Improve build_*_cast locations

2019-12-06 Thread Jason Merrill
On 12/6/19 11:14 AM, Paolo Carlini wrote: Hi, as promised, the below takes care of the various remaining casts. It's mostly mechanical, follows the same approach used for build_functional_cast. Tested x86_64-linux. It occurs to me that once we're passing the location into the build_* functi

Re: [PATCH] add -Wmismatched-tags (PR 61339)

2019-12-06 Thread Jason Merrill
On 12/5/19 6:47 PM, Jakub Jelinek wrote: On Thu, Dec 05, 2019 at 04:33:10PM -0700, Martin Sebor wrote: It's hard to distinguish between this type and the previous one by name; this one should probably have "map" in its name. +static GTY (()) record_to_locs_t *rec2loc; ... +    rec2loc = new

Re: [C++ PATCH] CWG 1299, not extending temporary lifetime for ?: (PR c++/92831)

2019-12-06 Thread Jason Merrill
On 12/6/19 11:28 AM, Jakub Jelinek wrote: Hi! This is a reason latest firefox is miscompiled by G++ 9, seems DR 1299 says in [class.temporary]/(6.7) that reference binding to a temporary object from the second or third operand of a conditional expression should have extended lifetime too, but ex

Re: [C++ PATCH] Tweak concept diagnostics

2019-12-06 Thread Jason Merrill
On 12/6/19 3:20 PM, Jakub Jelinek wrote: Hi! I've noticed that while for requires keyword we have a diagnostics like error_at (cp_lexer_peek_token (parser->lexer)->location, "% only available with " "%<-std=c++2a%> or %<-fconcepts%>"); for con

Re: [C++ PATCH] (temporarily) undefine __cpp_consteval

2019-12-06 Thread Jason Merrill
On 11/29/19 4:30 AM, Jakub Jelinek wrote: Hi! When submitting the P1902R1 patch for missing feature macros, I completely forgot that we can't claim consteval support, because we have the /* FIXME: For now. */ if (virtualp && (inlinep & 8) != 0) { sorry_at (DECL_SOURCE_LOCATION

Re: C++ PATCH for c++/91678 - wrong error with decltype and location wrapper

2019-12-06 Thread Jason Merrill
On 12/6/19 7:18 PM, Marek Polacek wrote: [ Sorry for dropping the ball on this. ] On Tue, Sep 17, 2019 at 11:59:02PM -0400, Jason Merrill wrote: On 9/16/19 1:12 PM, Marek Polacek wrote: On Sun, Sep 15, 2019 at 10:18:29AM -0400, Jason Merrill wrote: On 9/5/19 9:24 PM, Marek Polacek wrote

Re: [C++ Patch] Improve build_*_cast locations

2019-12-08 Thread Jason Merrill
On 12/6/19 4:36 PM, Paolo Carlini wrote: Hi, On 06/12/19 18:53, Jason Merrill wrote: On 12/6/19 11:14 AM, Paolo Carlini wrote: Hi, as promised, the below takes care of the various remaining casts. It's mostly mechanical, follows the same approach used for build_functional_cast. T

Re: [C++ Patch] Improve build_*_cast locations

2019-12-09 Thread Jason Merrill
On 12/9/19 7:06 AM, Paolo Carlini wrote: Hi, On 08/12/19 18:51, Jason Merrill wrote: Hmm, is the change to cp_expr really necessary vs. using protected_set_expr_location? Yes, using protected_set_expr_location works fine in this case, I suppose because we are dealing with expressions anyway

Re: [PATCH] implement pre-c++20 contracts

2019-12-09 Thread Jason Merrill
On 11/13/19 2:07 PM, Jeff Chapman wrote: Attached is a patch that implements pre-c++20 contracts. This comes from a long running development branch which included ChangeLog entries as we went, which are included in the patch itself. The repo and initial wiki are located here: https://gitlab.com/l

Re: [PATCH] implement pre-c++20 contracts

2019-12-09 Thread Jason Merrill
On 12/10/19 12:58 AM, Jason Merrill wrote: On 11/13/19 2:07 PM, Jeff Chapman wrote: Attached is a patch that implements pre-c++20 contracts. This comes from a long running development branch which included ChangeLog entries as we went, which are included in the patch itself. The repo and

[C++ PATCH] PR c++/92560 - ICE with decltype and rewritten operator.

2019-12-10 Thread Jason Merrill
A call as the immediate operand of decltype is handled differently; we don't create an object of the return type as we do normally. But in the case of a rewritten operator, we're adding another call as a wrapper, so the inner call doesn't get the special handling. Tested x86_64-pc-linux-gnu, appl

[C++ PATCH] Fix C++20 structural type vs. private base.

2019-12-10 Thread Jason Merrill
In my patch to implement C++20 "structural type" I tried to set the access flags on the artificial base fields appropriately, but failed. I was copying TREE_PRIVATE from the binfo, but TREE_PRIVATE on binfo is just a temporary cache for dfs_access_in_type; we really need to get the inheritance acc

[C++ PATCH] PR c++/92847 - C++20 comparison ambiguity with class template.

2019-12-10 Thread Jason Merrill
This testcase demonstrates that looking at cand->template_decl is not a good starting place for finding the most general template, as it is only set for primary templates. Tested x86_64-pc-linux-gnu, applying to trunk. * call.c (cand_parms_match): Handle all templated functions. --- gcc/

[C++ PATCH] PR c++/92859 - ADL and bit-field.

2019-12-11 Thread Jason Merrill
We also need unlowered_expr_type when considering associated types for ADL. Tested x86_64-pc-linux-gnu, applying to trunk. * name-lookup.c: Use unlowered_expr_type. --- gcc/cp/name-lookup.c | 2 +- gcc/testsuite/g++.dg/overload/bit-field1.C | 18 ++

[C++ PATCH] PR c++/92446 - deduction of class NTTP.

2019-12-11 Thread Jason Merrill
Another place we need to look through the VIEW_CONVERT_EXPR we add to make a use of a class NTTP have const type. Tested x86_64-pc-linux-gnu, applying to trunk. * pt.c (deducible_expression): Look through VIEW_CONVERT_EXPR. --- gcc/cp/pt.c | 2 +- gcc/te

[C++ PATCH] PR c++/92774 - ICE with implicitly deleted operator<=>.

2019-12-11 Thread Jason Merrill
Missing error-recovery code. While I was poking at this I also figured we don't need to iterate over the members of a union. Tested x86_64-pc-linux-gnu, applying to trunk. * method.c (comp_info::~comp_info): Factor out of... (build_comparison_op): Here. Handle error return from

[C++ PATCH] PR c++/57082 - new X{} and private destructor.

2019-12-11 Thread Jason Merrill
build_new_1 already passes tf_no_cleanup to build_value_init, but in this testcase we end up calling build_value_init by way of build_special_member_call, so we need to pass it to that function as well. Tested x86_64-pc-linux-gnu, applying to trunk. * init.c (build_new_1): Also pass tf_no

[C++ PATCH] PR c++/92105 - decltype(decltype) error cascade.

2019-12-11 Thread Jason Merrill
The primary change here is to do the CPP_DECLTYPE replacement even when we get an error, so we don't keep trying and giving the same parse error each time. We also commit to the tentative firewall parse more often, leading to better diagnostics. Tested x86_64-pc-linux-gnu, applying to trunk.

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