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

2019-12-11 Thread Jason Merrill
On 12/11/19 2:03 AM, Sandra Loosemore wrote: On 12/6/19 3:41 PM, Jeff Law wrote: On Wed, 2019-11-13 at 09:27 -0700, Sandra Loosemore wrote: I bootstrapped and regression-tested this on x86_64-linux-gnu.  There are a few regressions involving these tests: gcc.dg/tree-ssa/pr77445-2.c I believe

Re: [C++ PATCH] c++/92878 - Parenthesized init of aggregates in new-expression.

2019-12-11 Thread Jason Merrill
On 12/10/19 2:13 PM, Marek Polacek wrote: Ville pointed out that our paren init of aggregates doesn't work for auto a = new A(1, 2, 3); and I think it should: A new-expression that creates an object of type T initializes that object as follows: ... -- Otherwise, the new-initializer is inter

Re: [C++ PATCH] Fix -std=c++17 and earlier handling of CLASSTYPE_NON_AGGREGATE (PR c++/92869)

2019-12-11 Thread Jason Merrill
On 12/10/19 3:47 PM, Jakub Jelinek wrote: Hi! In C++20, types with user-declared constructors are not aggregate types, while in C++17 only types with user-provided or explicit constructors. In check_bases_and_members we handle it properly: CLASSTYPE_NON_AGGREGATE (t) |= ((cxx_dialect < c

Re: C++ PATCH for c++/88337 - Implement P1327R1: Allow dynamic_cast in constexpr

2019-12-12 Thread Jason Merrill
On 12/11/19 5:50 PM, Marek Polacek wrote: On Fri, Nov 22, 2019 at 04:11:53PM -0500, Jason Merrill wrote: On 11/8/19 4:24 PM, Marek Polacek wrote: 2) [class.cdtor] says that when a dynamic_cast is used in a constructor or destructor and the operand of the dynamic_cast refers to the object

[C++ PATCH] PR c++/92496 - ICE with <=> and no #include .

2019-12-12 Thread Jason Merrill
Normal error-recovery. Tested x86_64-pc-linux-gnu, applying to trunk. * typeck.c (cp_build_binary_op): Handle error from spaceship_type. --- gcc/cp/typeck.c | 6 +- gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg3.C | 12 2 files changed

Re: C++ PATCH for c++/88337 - Implement P1327R1: Allow dynamic_cast in constexpr

2019-12-13 Thread Jason Merrill
On 12/13/19 3:20 PM, Marek Polacek wrote: On Thu, Dec 12, 2019 at 02:38:29PM -0500, Jason Merrill wrote: On 12/11/19 5:50 PM, Marek Polacek wrote: On Fri, Nov 22, 2019 at 04:11:53PM -0500, Jason Merrill wrote: On 11/8/19 4:24 PM, Marek Polacek wrote: 2) [class.cdtor] says that when a

Re: [PATCH] Fix out of bounds array access in the preprocessor (PR preprocessor/92919)

2019-12-14 Thread Jason Merrill
On 12/14/19 3:09 AM, Jakub Jelinek wrote: Hi! wide_str_to_charconst function relies on the string passed to it having at least two wide characters, the one we are looking for and the terminating NUL. The empty wide character literal like L'' or u'' or U'' is handled earlier and will not reach t

Re: C++ PATCH for c++/88337 - Implement P1327R1: Allow dynamic_cast in constexpr

2019-12-16 Thread Jason Merrill
On 12/14/19 4:25 PM, Marek Polacek wrote: On Fri, Dec 13, 2019 at 05:56:57PM -0500, Jason Merrill wrote: On 12/13/19 3:20 PM, Marek Polacek wrote: + /* Given dynamic_cast(v), + + [expr.dynamic.cast] If C is the class type to which T points or refers, + the runtime check logically

Re: C++ PATCH for c++/88337 - Implement P1327R1: Allow dynamic_cast in constexpr

2019-12-16 Thread Jason Merrill
On 12/16/19 3:55 PM, Jason Merrill wrote: On 12/14/19 4:25 PM, Marek Polacek wrote: On Fri, Dec 13, 2019 at 05:56:57PM -0500, Jason Merrill wrote: On 12/13/19 3:20 PM, Marek Polacek wrote: +  /* Given dynamic_cast(v), + + [expr.dynamic.cast] If C is the class type to which T points or

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

2019-12-16 Thread Jason Merrill
On 12/9/19 7:29 PM, Martin Sebor wrote: Just a few nits: +/* A mapping between a TYPE_DECL for a class and the class_decl_loc_t + description above. */ +typedef hash_map class_to_loc_map_t; +static class_to_loc_map_t class2loc; I think we can make these members of class_decl_loc_t, now tha

Re: [C++ PATCH] Make same_type_p return false for gnu_vector_type_p differences (PR 92789)

2019-12-16 Thread Jason Merrill
On 12/12/19 10:16 AM, Richard Sandiford wrote: As Jason pointed out in the review of the C++ gnu_vector_type_p patch: https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00173.html the real fix for the XFAILs in acle/general-c++/gnu_vectors_*.C is to make same_type_p return false for two types i

Re: [PATCH] PR C++/92739

2019-12-16 Thread Jason Merrill
On 12/2/19 9:30 AM, Andrew Sutton wrote: Find attached. gcc/cp/ * parser.c (cp_parser_constraint_requires_parens): Exclude attributes as postfix expressions. gcc/testsuite/ * g++.dg/concepts-pr92739.C: New test. The testcase didn't come through

Re: [PATCH] Fix attribute((section)) for templates

2019-12-16 Thread Jason Merrill
On 11/29/19 6:23 PM, Strager Neds wrote: I discovered an issue with my patch. I need help resolving it. Take the following code for example: template struct s { static inline int __attribute__((section(".testsection"))) var = 1; }; struct public_symbol {};

[C++ PATCH] PR c++/91165 - verify_gimple ICE with cached constexpr.

2019-12-16 Thread Jason Merrill
It seems we need to unshare even non-CONSTRUCTOR expressions that we are going to stick in the constexpr_call_table, so we don't end up sharing the same e.g. ADDR_EXPR between two different functions. I now think I understand why unsharing CONSTRUCTOR arguments was improving memory performance: se

Re: [C++ PATCH] Improve C++ error recovery (PR c++/59655)

2019-12-17 Thread Jason Merrill
On 12/10/19 4:02 PM, Jakub Jelinek wrote: Hi! On the following testcase, we emit 2 errors and 1 warning, when the user really should see one error. The desirable error is static_assert failure, the bogus error is during error recovery, complaining that a no_linkage template isn't defined when i

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

2019-12-17 Thread Jason Merrill
On 12/16/19 6:31 PM, Martin Sebor wrote: + class_decl_loc_t *rdl = class2loc.get (type_decl); + if (!rdl) +{ + rdl = &class2loc.get_or_insert (type_decl); I was thinking class_decl_loc_t *rdl = &class2loc.get_or_insert (type_decl); OK with that change. Jason

[C++ PATCH] * name-lookup.c (get_std_name_hint): Add std::byte.

2019-12-17 Thread Jason Merrill
I noticed we didn't have a hint for std::byte yet. Tested x86_64-pc-linux-gnu, applying to trunk. --- gcc/cp/name-lookup.c| 2 ++ gcc/testsuite/g++.dg/lookup/missing-std-include-9.C | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 gcc/testsuite/g++.dg

[C++ PATCH] PR c++/92576 - redeclaration of variable template.

2019-12-17 Thread Jason Merrill
The variable templates patch way back when forgot to add handling here. The simplest answer seems to be recursing to the underlying declaration. Tested x86_64-pc-linux-gnu, applying to trunk. * decl.c (redeclaration_error_message): Recurse for variable templates. --- gcc/cp/decl

[C++ PATCH] PR c++/79592 - missing explanation of invalid constexpr.

2019-12-17 Thread Jason Merrill
We changed months back to use the pre-generic form for constexpr evaluation, but explain_invalid_constexpr_fn was still using DECL_SAVED_TREE. This mostly works, but misses some issues due to folding. So with this patch we save the pre-generic form of constexpr functions even when we know they ca

[C++ PATCH] PR c++/12333 - X::~X() with implicit this->.

2019-12-17 Thread Jason Merrill
Well, this one has been around for a while. this->X::~X() is handled by finish_class_member_access_expr and its lookup_destructor subroutine; let's use it in cp_parser_lookup_name for the case where this-> is implicit. Tested x86_64-pc-linux-gnu, applying to trunk. * parser.c (cp_parser_

[C++ PATCH] PR c++/12333 - X::~X() with implicit this->.

2019-12-18 Thread Jason Merrill
this->X::~X() is handled by finish_class_member_access_expr and its lookup_destructor subroutine; let's use it in cp_parser_lookup_name for the case where this-> is implicit. I tried replacing the other destructor code here with just the call to lookup_destructor, but that regressed handling of na

Re: [C++ Patch] Improve throw, sizeof, and alignof locations & more

2019-12-18 Thread Jason Merrill
On 12/16/19 6:06 PM, Paolo Carlini wrote: Hi, another batch of work. Primarily, more of the idea of moving up the construction of the compound location thus passing it to the cxx_sizeof_or_alignof* and build_throw functions to obtain better locations for all the diagnostics issued by the latt

[C++ PATCH] PR c++/91165 follow-on tweak

2019-12-18 Thread Jason Merrill
I talked in the PR about possibly stripping the location from the args in the hash table, since if we use the cache the locations would be wrong, but didn't actually do anything about that. Then I noticed that there's already unshare_expr_without_location... Tested x86_64-pc-linux-gnu, applying t

[C++ PATCH 1/2] PR c++/66139 - EH cleanups for partially constructed aggregates.

2019-12-19 Thread Jason Merrill
There were several overlapping PRs about failure to clean up fully constructed subobjects when an exception is thrown during aggregate initialization of a temporary. I fixed this for non-temporaries in the context of 57510, but that fix didn't handle temporaries. So this patch does split_nonconst

[C++ PATCH 2/2] PR c++/52320 - EH cleanups for partially constructed arrays.

2019-12-19 Thread Jason Merrill
This testcase wasn't fixed by the 66139 patch; split_nonconstant_init_1 was failing to add a cleanup for an array member of a class (e.g. e1) that will run if initializing a later member (e.g. e2) throws. Tested x86_64-pc-linux-gnu, applying to trunk. * typeck2.c (split_nonconstant_init_1

Re: [C++ PATCH] PR c++/92576 - redeclaration of variable template.

2019-12-19 Thread Jason Merrill
On Thu, Dec 19, 2019 at 9:05 AM Christophe Lyon wrote: > On Tue, 17 Dec 2019 at 22:46, Jason Merrill wrote: > > > > The variable templates patch way back when forgot to add handling here. > The > > simplest answer seems to be recursing to the underlying declaration.

Re: [C++ PATCH] Make same_type_p return false for gnu_vector_type_p differences (PR 92789)

2019-12-19 Thread Jason Merrill
On Thu, Dec 19, 2019 at 11:52 AM Richard Sandiford < richard.sandif...@arm.com> wrote: > Jason Merrill writes: > > On 12/12/19 10:16 AM, Richard Sandiford wrote: > >> As Jason pointed out in the review of the C++ gnu_vector_type_p patch: > >> > >>

Re: [C++ PATCH] PR c++/92745 - bogus error when initializing array of vectors.

2019-12-20 Thread Jason Merrill
On 12/20/19 3:27 PM, Marek Polacek wrote: In r268428 I changed reshape_init_r in such a way that when it sees a nested { } in a CONSTRUCTOR with missing braces, it just returns the initializer: + else if (COMPOUND_LITERAL_P (stripped_init) ... + ++d->cur; + gcc_assert (!BRACE_

Re: [C++ PATCH] PR c++/92745 - bogus error when initializing array of vectors.

2019-12-20 Thread Jason Merrill
On 12/20/19 3:27 PM, Marek Polacek wrote: In r268428 I changed reshape_init_r in such a way that when it sees a nested { } in a CONSTRUCTOR with missing braces, it just returns the initializer: + else if (COMPOUND_LITERAL_P (stripped_init) ... + ++d->cur; + gcc_assert (!BRACE_

Re: [C++ PATCH] PR c++/92974 - bogus location for enum and non-enum in ?: warning.

2019-12-20 Thread Jason Merrill
On 12/19/19 6:05 PM, Marek Polacek wrote: build_min_non_dep wasn't setting any location so when we were emitting the warning in the following test while instantiating a template, it's location was UNKNOWN_LOCATION. Rather than adding a location_t parameter, let's use the location from the origin

Re: [C++ PATCH] Don't ignore side-effects on decltype(nullptr) typed args passed to ... (PR c++/92992)

2019-12-20 Thread Jason Merrill
On 12/18/19 6:40 PM, Jakub Jelinek wrote: Hi! While looking at PR92666, I've spotted a wrong-code issue where we ignore any side-effects on arguments passed to ellipsis if they have decltype(nullptr) type. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk and rel

Re: [C++] Fix ICE for binding lax vector conversions to references (PR 93014)

2019-12-20 Thread Jason Merrill
On 12/19/19 11:33 AM, Richard Sandiford wrote: This test: typedef unsigned int v4si __attribute__ ((vector_size(16))); typedef unsigned char v16qi __attribute__ ((vector_size(16))); extern v16qi x; v4si &y = x; ICEs with: a.c:4:11: internal compiler error: in convert_like_real, at cp/call.c:76

Re: [C++ PATCH] Fix -Wunused-but-set-* false positives in arg passing to ... (PR c++/92666)

2019-12-20 Thread Jason Merrill
On 12/18/19 6:44 PM, Jakub Jelinek wrote: Hi! convert_arg_to_ellipsis used to call decay_conversion for all types (which calls mark_rvalue_use), but it doesn't anymore in GCC 10, and while for INTEGRAL_OR_ENUMERATION_TYPE_P args it calls cp_perform_integral_promotions which does that too and for

Re: [C++ PATCH] Disallow defaulted comparison operators in C++11-17 modes (PR c++/92973)

2019-12-20 Thread Jason Merrill
On 12/17/19 3:59 PM, Jakub Jelinek wrote: Hi! As discussed on IRC, defaulted comparison operators were added only in C++2a, so we shouldn't accept it in older standard modes. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? OK. 2019-12-17 Jakub Jelinek PR c++

Re: [C++ PATCH] Fix bad defaulted comparison operator error recovery (PR c++/92966)

2019-12-20 Thread Jason Merrill
On 12/17/19 3:57 PM, Jakub Jelinek wrote: Hi! When the prototype of defaulted comparison operator is incorrect, we set DECL_MAYBE_DELETED, but don't set DECL_DEFAULTED_FN and other flags, so we ICE during synthetize_method. Seems only marking DECL_MAYBE_DELETED those operators that we are also

Re: [C++ PATCH] Avoid weird inform without previos error during SFINAE (PR c++/92965)

2019-12-20 Thread Jason Merrill
On 12/17/19 3:51 PM, Jakub Jelinek wrote: Hi! On the following testcase, complain & tf_error is 0 during sfinae, so we don't emit error, but we called structural_type_p with explain=true anyway, which emitted the inform messages. Fixed by doing it only when we emit the error. Bootstrapped/regte

Re: C++ PATCH for c++/88337 - Implement P1327R1: Allow dynamic_cast in constexpr

2019-12-21 Thread Jason Merrill
On 12/17/19 5:34 PM, Marek Polacek wrote: On Mon, Dec 16, 2019 at 04:00:14PM -0500, Jason Merrill wrote: On 12/16/19 3:55 PM, Jason Merrill wrote: On 12/14/19 4:25 PM, Marek Polacek wrote: On Fri, Dec 13, 2019 at 05:56:57PM -0500, Jason Merrill wrote: On 12/13/19 3:20 PM, Marek Polacek wrote

Re: [C++ PATCH] PR c++/92745 - bogus error when initializing array of vectors.

2019-12-25 Thread Jason Merrill
On Fri, Dec 20, 2019, 6:22 PM Marek Polacek wrote: > On Fri, Dec 20, 2019 at 05:56:39PM -0500, Jason Merrill wrote: > > On 12/20/19 3:27 PM, Marek Polacek wrote: > > > In r268428 I changed reshape_init_r in such a way that when it sees > > > a nested { } in a CONSTRUC

Re: [C++ PATCH] Fix up parsing of T (__attribute__(()) fn) (int) in C++17 mode (PR c++/92438)

2019-12-25 Thread Jason Merrill
On 12/20/19 6:27 PM, Jakub Jelinek wrote: Hi! In C++17/2a mode, cp_parser_constructor_declarator_p because of deduction guides considers constructor_p in more cases and returns true on typedef struct S { int x; } T; T (__attribute__((unused)) qux) (T x); just because constructor arguments may st

Re: [C++ Patch] Improve delete expressions locations

2019-12-25 Thread Jason Merrill
On 12/20/19 11:35 AM, Paolo Carlini wrote: Hi, more of the last idea, this time applied to cp_parser_delete_expression / delete_sanity (thus build_delete and build_vec_delete which provide tests). Nothing particularly remarkable in this case. Tested x86_64-linux. Thanks, Paolo.

Re: [PATCH 09/13] OpenACC 2.6 deep copy: C and C++ front-end parts

2019-12-26 Thread Jason Merrill
On 12/18/19 1:03 AM, Julian Brown wrote: This patch has been broken out of the "OpenACC 2.6 manual deep copy support" patch, last posted here: https://gcc.gnu.org/ml/gcc-patches/2019-11/msg02376.html This part contains the C and C++ changes to parse attach and detach clauses and struct membe

Re: [RFC][C++ PATCH] Don't mangle attributes that have a space in their name

2019-12-26 Thread Jason Merrill
On 12/18/19 1:24 PM, Richard Sandiford wrote: The SVE port needs to maintain a different type identity for GNU vectors and "SVE vectors" even during LTO, since the types use different ABIs. The easiest way of doing that seemed to be to use type attributes. However, these type attributes shouldn

Re: [C++ PATCH v2] Don't mangle attributes that have a space in their name

2020-01-02 Thread Jason Merrill
On 12/27/19 11:00 AM, Richard Sandiford wrote: Jason Merrill writes: On 12/18/19 1:24 PM, Richard Sandiford wrote: The SVE port needs to maintain a different type identity for GNU vectors and "SVE vectors" even during LTO, since the types use different ABIs. The easiest way of

[C++ PATCH] Reject class template placeholder as non-type template parm type in C++17.

2020-01-03 Thread Jason Merrill
Jakub noticed that we were improperly allowing this in C++17 mode. Tested x86_64-pc-linux-gnu, applying to trunk. * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in C++17. --- gcc/cp/pt.c| 11 ++- gcc/testsuite/g++.dg/cpp

[C++ PATCH] PR c++/93033 - incorrect tree node sharing with array init.

2020-01-03 Thread Jason Merrill
The split_nonconstant_init piece is the only one necessary to fix the testcase, but it occurred to me that we might as well not split when -fno-exceptions. Tested x86_64-pc-linux-gnu, applying to trunk. * typeck2.c (split_nonconstant_init): Unshare non-decl. * cp-gimplify.c (cp_gi

Re: [C++ PATCH] Fix up cp-gimplify.c ICE (PR c++/93046)

2020-01-04 Thread Jason Merrill
On 1/3/20 6:37 PM, Jakub Jelinek wrote: On the following testcase since the split_nonconstant_init move on the COND_EXPR with omitted middle-end operand we end up with the operator bool called on a TARGET_EXPR in the first operand and the same TARGET_EXPR appearing in INIT_EXPR in the second oper

Re: [C++ PATCH] Avoid bogus errors due to -Wredundant-tags (PR c++/93138)

2020-01-04 Thread Jason Merrill
On 1/3/20 6:34 PM, Jakub Jelinek wrote: Hi! For -Wredundant-tags or -Wmismatched-tags, cp_parser_maybe_warn_enum_key and cp_parser_check_class_key perform an extra name lookup to check if the enum/struct/class/union keyword is redundant, but as the testcase shows, if it is not redundant, but the

Re: [C++ Patch] Improve build_new locations

2020-01-06 Thread Jason Merrill
On 1/2/20 4:23 AM, Paolo Carlini wrote: @@ -19320,8 +19320,8 @@ tsubst_copy_and_build (tree t, tree op1 = tsubst (TREE_OPERAND (t, 1), args, complain, in_decl); tree op2 = RECUR (TREE_OPERAND (t, 2)); - ret = build_new (&placement_vec, op1, op2, &init_vec, -

Re: [C++ PATCH] Avoid caching constexpr calls that allocate something that they don't deallocate or vice versa (PR c++/91369)

2020-01-06 Thread Jason Merrill
On 1/5/20 8:04 AM, Jakub Jelinek wrote: Hi! The caching of constexpr calls breaks the following testcase. The problem is that constexpr calls that allocate from heap something that they don't deallocate or calls that deallocate something they haven't allocated aren't stateless for the constexpr

[C++ PATCH] PR c++/92552 - ICE with inherited constrained default ctor.

2020-01-06 Thread Jason Merrill
We set TYPE_HAS_USER_CONSTRUCTOR on the template type in lookup_using_decl, but we didn't copy it to the instantiation. Setting it in one_inherited_ctor is too late, as that gets called after we decide whether to set CLASSTYPE_LAZY_DEFAULT_CTOR. This change affects other testcases as well; the ch

Re: [PATCH] PR C++/92739

2020-01-06 Thread Jason Merrill
On 12/16/19 6:12 PM, Jason Merrill wrote: On 12/2/19 9:30 AM, Andrew Sutton wrote: Find attached.     gcc/cp/ * parser.c (cp_parser_constraint_requires_parens): Exclude attributes as postfix expressions. gcc/testsuite/ * g++.dg/concepts-pr92739.C

[C++ PATCH] PR c++/47877 - -fvisibility-inlines-hidden and member templates.

2020-01-07 Thread Jason Merrill
DECL_VISIBILITY_SPECIFIED is also true if an enclosing scope has explicit visibility, and we don't want that to override -fvisibility-inlines-hidden. So check for the attribute specifically on the function, like we already do for template argument visibility restriction. Tested x86_64-pc-linux-gnu

Re: [C++ Patch] Improve build_new locations

2020-01-07 Thread Jason Merrill
On 1/7/20 5:46 AM, Paolo Carlini wrote: Hi, On 06/01/20 21:47, Jason Merrill wrote: On 1/2/20 4:23 AM, Paolo Carlini wrote: @@ -19320,8 +19320,8 @@ tsubst_copy_and_build (tree t,     tree op1 = tsubst (TREE_OPERAND (t, 1), args, complain, in_decl);   tree op2 = RECUR (TREE_OPERAND

[C++ PATCH 1/3] Remove constexpr support for DECL_BY_REFERENCE.

2020-01-08 Thread Jason Merrill
Since we switched to doing constexpr evaluation on pre-GENERIC trees, we don't have to handle DECL_BY_REFERENCE. Tested x86_64-pc-linux-gnu, applying to trunk. * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE support. --- gcc/cp/constexpr.c | 17 +++-

[C++ PATCH 2/3] PR c++/91369 - constexpr destructor and member initializer.

2020-01-08 Thread Jason Merrill
Previously it didn't matter whether we looked through a TARGET_EXPR in constexpr evaluation, but now that we have constexpr destructors it does. On IRC I mentioned the idea of clearing TARGET_EXPR_CLEANUP in digest_nsdmi_init, but since this initialization is expressed by an INIT_EXPR, it's better

[C++ PATCH 3/3] Add TARGET_EXPR_DIRECT_INIT_P sanity check.

2020-01-08 Thread Jason Merrill
The previous patch fixes an instance of directly expanding a TARGET_EXPR that has TARGET_EXPR_DIRECT_INIT_P set, which should never happen. So let's check for any other instances. Tested x86_64-pc-linux-gnu, applying to trunk. * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check

Re: [PATCH v3] c++: implement [[gnu::non_owning]] [PR110358]

2024-02-29 Thread Jason Merrill
On 2/29/24 19:12, Marek Polacek wrote: On Wed, Feb 28, 2024 at 06:03:54PM -0500, Jason Merrill wrote: Hmm, if we're also going to allow the attribute to be applied to a function, the name doesn't make so much sense. For a class, it says that the class refers to its initializer; for

Re: [PATCH] c++: Ensure DECL_CONTEXT is set for temporary vars [PR114005]

2024-03-01 Thread Jason Merrill
On 2/29/24 16:28, Nathaniel Shead wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? Alternatively we could update 'DECL_CONTEXT' only for 'make_temporary_var_for_ref_to_temp' in call.cc, as a more targetted fix, but I felt that this way it'd also fix any other similar issue

Re: [PATCH] c++/modules: Stream definitions for implicit instantiations [PR114170]

2024-03-01 Thread Jason Merrill
On 2/29/24 20:08, Nathaniel Shead wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? -- >8 -- An implicit instantiation has an initializer depending on whether DECL_INITIALIZED_P is set (like normal VAR_DECLs) which needs to be written to ensure that consumers of header mod

Re: [PATCH] c++/modules: depending local enums [PR104919, PR106009]

2024-03-01 Thread Jason Merrill
On 2/29/24 15:56, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- For local enums defined in a non-template function or a function template instantiation it seems we neglect to make the function depend on the enum definition, which u

Re: [PATCH] c++: auto(x) partial substitution [PR110025, PR114138]

2024-03-01 Thread Jason Merrill
On 2/29/24 14:17, Patrick Palka wrote: On Wed, 28 Feb 2024, Jason Merrill wrote: I wonder about, rather than returning it directly, setting its level to 1 for the substitution? Done, that works nicely. Then I wonder if it would be feasible to give all autos level 0 and adjust it here

Re: [PATCH] dwarf2out: Don't move variable sized aggregates to comdat [PR114015]

2024-03-01 Thread Jason Merrill
On 2/29/24 07:10, Jakub Jelinek wrote: Hi! The following testcase ICEs, because we decide to move that struct { char a[n]; } DW_TAG_structure_type into .debug_types section / DW_UT_type DWARF5 unit, but refer from there to a DW_TAG_variable (created artificially for the array bounds). Even with

Re: [PATCH] c++/modules: Stream definitions for implicit instantiations [PR114170]

2024-03-01 Thread Jason Merrill
On 3/1/24 08:41, Nathaniel Shead wrote: On Fri, Mar 01, 2024 at 08:18:09AM -0500, Jason Merrill wrote: On 2/29/24 20:08, Nathaniel Shead wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? -- >8 -- An implicit instantiation has an initializer depending on whet

Re: [PATCH] c++: auto(x) partial substitution [PR110025, PR114138]

2024-03-01 Thread Jason Merrill
On 3/1/24 10:17, Patrick Palka wrote: On Fri, 1 Mar 2024, Jason Merrill wrote: On 2/29/24 14:17, Patrick Palka wrote: On Wed, 28 Feb 2024, Jason Merrill wrote: I wonder about, rather than returning it directly, setting its level to 1 for the substitution? Done, that works nicely. Then I

Re: [PATCH] c++/modules: depending local enums [PR104919, PR106009]

2024-03-01 Thread Jason Merrill
On 3/1/24 10:00, Patrick Palka wrote: On Fri, 1 Mar 2024, Jason Merrill wrote: On 2/29/24 15:56, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- For local enums defined in a non-template function or a function templ

Re: [PATCH] c++, v2: Fix up decltype of non-dependent structured binding decl in template [PR92687]

2024-03-01 Thread Jason Merrill
On 3/1/24 02:55, Jakub Jelinek wrote: On Thu, Feb 29, 2024 at 12:50:47PM +0100, Jakub Jelinek wrote: finish_decltype_type uses DECL_HAS_VALUE_EXPR_P (expr) check for DECL_DECOMPOSITION_P (expr) to determine if it is array/struct/vector/complex etc. subobject proxy case vs. structured binding usi

Re: [PATCH] c++/modules: depending local enums [PR104919, PR106009]

2024-03-01 Thread Jason Merrill
On 3/1/24 10:32, Jason Merrill wrote: On 3/1/24 10:00, Patrick Palka wrote: On Fri, 1 Mar 2024, Jason Merrill wrote: On 2/29/24 15:56, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- For local enums defined in a non-templ

Re: [PATCH] c++/modules: depending local enums [PR104919, PR106009]

2024-03-01 Thread Jason Merrill
On 3/1/24 11:45, Patrick Palka wrote: On Fri, 1 Mar 2024, Jason Merrill wrote: This was nearly enough to make things work, except we now ran into issues with the local TYPE/CONST_DECL copies when streaming the constexpr version of a function body. It occurred to me that we don't need to

Re: [PATCH] c++/modules: depending local enums [PR104919, PR106009]

2024-03-01 Thread Jason Merrill
On 3/1/24 12:08, Patrick Palka wrote: On Fri, 1 Mar 2024, Patrick Palka wrote: On Fri, 1 Mar 2024, Jason Merrill wrote: On 3/1/24 10:00, Patrick Palka wrote: On Fri, 1 Mar 2024, Jason Merrill wrote: On 2/29/24 15:56, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu

Re: [PATCH v4] c++: implement [[gnu::non_owning]] [PR110358]

2024-03-01 Thread Jason Merrill
On 3/1/24 12:39, Marek Polacek wrote: On Thu, Feb 29, 2024 at 07:30:02PM -0500, Jason Merrill wrote: On 2/29/24 19:12, Marek Polacek wrote: On Wed, Feb 28, 2024 at 06:03:54PM -0500, Jason Merrill wrote: Hmm, if we're also going to allow the attribute to be applied to a function, the

Re: [PATCH] c++/modules: depending local enums [PR104919, PR106009]

2024-03-01 Thread Jason Merrill
On 3/1/24 13:28, Patrick Palka wrote: On Fri, 1 Mar 2024, Jason Merrill wrote: On 3/1/24 12:08, Patrick Palka wrote: On Fri, 1 Mar 2024, Patrick Palka wrote: On Fri, 1 Mar 2024, Jason Merrill wrote: On 3/1/24 10:00, Patrick Palka wrote: On Fri, 1 Mar 2024, Jason Merrill wrote: On 2/29

Re: [PATCH] c++/modules: relax diagnostic about GMF contents

2024-03-01 Thread Jason Merrill
On 2/15/24 16:51, Patrick Palka wrote: On Thu, 15 Feb 2024, Jason Merrill wrote: Relaxing to pedwarn is fine, but I think it should be on by default, not just with -pedantic. So it should get a new option. Ah, like so? I'm not sure about naming the option Wmodules-gmf-contents vs just

Re: [PATCH] c++/modules: complete_vars ICE with non-exported constexpr var

2024-03-01 Thread Jason Merrill
On 2/26/24 15:52, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- Here during stream-in of the non-exported constexpr var 'a' we call maybe_register_incomplete_var, which ends up taking the second branch and pushing {a, NULL_TREE} on

Re: [PATCH] c++/modules: depending local enums [PR104919, PR106009]

2024-03-01 Thread Jason Merrill
On 3/1/24 14:34, Patrick Palka wrote: On Fri, 1 Mar 2024, Jason Merrill wrote: On 3/1/24 13:28, Patrick Palka wrote: On Fri, 1 Mar 2024, Jason Merrill wrote: On 3/1/24 12:08, Patrick Palka wrote: On Fri, 1 Mar 2024, Patrick Palka wrote: On Fri, 1 Mar 2024, Jason Merrill wrote: On 3/1

Re: [PATCH v5] c++: implement [[gnu::non_owning]] [PR110358]

2024-03-01 Thread Jason Merrill
On 3/1/24 14:24, Marek Polacek wrote: On Fri, Mar 01, 2024 at 01:19:40PM -0500, Jason Merrill wrote: On 3/1/24 12:39, Marek Polacek wrote: @option{-Wdangling-reference} also warns about code like @smallexample @@ -3932,6 +3935,10 @@ struct Span @{ as @code{std::span}-like; that is

Re: [PATCH v5] c++: implement [[gnu::non_owning]] [PR110358]

2024-03-01 Thread Jason Merrill
On 3/1/24 16:23, Patrick Palka wrote: Sorry for not asking this sooner, but does it matter whether we attach the attribute to the function type rather than the function declaration? I noticed e.g. nodiscard gets attached to the decl. And we document it as a function attribute despite attaching

Re: [PATCH] c++/modules: Support exporting using-decls in same namespace as target

2024-03-04 Thread Jason Merrill
On 3/3/24 18:11, Nathaniel Shead wrote: Came across this issue while working on another PR. Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? Or otherwise for GCC 15? OK. -- >8 -- Currently a using-declaration bringing a name into its own namespace is a no-op, except for func

Re: [PATCH] c++: Don't set DECL_CONTEXT to nested template-template parameters [PR98881]

2024-03-04 Thread Jason Merrill
On 3/2/24 01:54, Nathaniel Shead wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? -- >8 -- When streaming in a nested template-template parameter as in the attached testcase, we end up reaching the containing template-template parameter in 'tpl_parms_fini'. We should not

Re: [PATCH] c++: DECL_DECOMPOSITION_P cleanup

2024-03-04 Thread Jason Merrill
On 3/1/24 19:59, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for 15? OK for 15, yes. -- >8 -- DECL_DECOMPOSITION_P already checks VAR_P but we repeat the check in a lot of places. gcc/cp/ChangeLog: * decl.cc (duplicate_decls): Don't check VAR_P before

Re: [PATCH] c++: Fix template deduction for conversion operators with xobj parameters [PR113629]

2024-03-05 Thread Jason Merrill
On 3/5/24 17:47, Nathaniel Shead wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? -- >8 -- Unification for conversion operators (DEDUCE_CONV) doesn't perform transformations like handling forwarding references. This is correct in general, but not for xobj parameters, whic

Re: [PATCH] c++: ICE with noexcept and local specialization [PR114114]

2024-03-05 Thread Jason Merrill
On 3/5/24 15:56, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? OK. -- >8 -- Here we ICE because we call register_local_specialization while local_specializations is null, so local_specializations->put (); crashes on null this. It's null since maybe_in

Re: [PATCH] c++/modules: befriending template from current class scope

2024-03-05 Thread Jason Merrill
On 2/26/24 15:52, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? OK. -- >8 -- Here the TEMPLATE_DECL representing the template friend declaration for B has class scope since B has class scope, but get_merge_kind assumes all DECL_UNINSTANT

Re: [PATCH v2] c++: Fix template deduction for conversion operators with xobj parameters [PR113629]

2024-03-05 Thread Jason Merrill
On 3/5/24 22:46, Nathaniel Shead wrote: On Tue, Mar 05, 2024 at 06:19:07PM -0500, Jason Merrill wrote: On 3/5/24 17:47, Nathaniel Shead wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? -- >8 -- Unification for conversion operators (DEDUCE_CONV) doesn't

Re: [PATCH] c++/modules: Prevent emission of really-extern vtables in importers [PR114229]

2024-03-06 Thread Jason Merrill
On 3/5/24 22:06, Nathaniel Shead wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? -- >8 -- Currently, reading a variable definition always marks that decl as DECL_NOT_REALLY_EXTERN, with anything else imported still being considered external. This is not sufficient for vt

Re: [PATCH] c++: Fix up parameter pack diagnostics on xobj vs. varargs functions [PR113802]

2024-03-06 Thread Jason Merrill
On 2/16/24 17:15, Jakub Jelinek wrote: On Fri, Feb 16, 2024 at 10:47:47PM +0100, Jakub Jelinek wrote: The following patch works. Or yet another option would be instead of (sometimes) clearing declarator->parameter_pack_p when we diagnose this bug for error recovery ignore the this specifier.

Re: [PATCH] dwarf2out, v3: Emit DW_AT_export_symbols on anon unions/structs [PR113918]

2024-03-06 Thread Jason Merrill
On 2/16/24 16:06, Jakub Jelinek wrote: On Fri, Feb 16, 2024 at 03:40:39PM -0500, Jason Merrill wrote: --- gcc/cp/cp-objcp-common.cc.jj2024-02-13 12:50:21.666846296 +0100 +++ gcc/cp/cp-objcp-common.cc 2024-02-16 20:40:51.374763528 +0100 @@ -410,6 +410,15 @@ cp_type_dwarf_attribute

Re: [PATCH] c-family, c++, v2: Fix up handling of types which may have padding in __atomic_{compare_}exchange

2024-03-06 Thread Jason Merrill
On 2/20/24 05:02, Jakub Jelinek wrote: On Tue, Feb 20, 2024 at 09:01:10AM +0100, Richard Biener wrote: I'm not sure those would be really equivalent (MEM_REF vs. V_C_E as well as combined vs. split). It really depends how RTL expansion handles this (as you can see padding can be fun here). So

Re: [PATCH] c++/modules: inline namespace abi_tag streaming [PR110730]

2024-03-06 Thread Jason Merrill
On 3/6/24 14:10, Patrick Palka wrote: Tested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- The unreduced testcase from this PR crashes at runtime ultimately because we don't stream the abi_tag attribute on inline namespaces and so the filesystem::current_path() call resolves to

Re: [PATCH] c++: Don't set DECL_CONTEXT to nested template-template parameters [PR98881]

2024-03-06 Thread Jason Merrill
for template template parameters. (trees_in::tpl_parms_fini): Read it. gcc/testsuite/ChangeLog: * g++.dg/modules/tpl-tpl-parm-3.h: New test. * g++.dg/modules/tpl-tpl-parm-3_a.H: New test. * g++.dg/modules/tpl-tpl-parm-3_b.C: New test.

Re: [PATCH] c++: Fix ICE diagnosing incomplete type of overloaded function set [PR98356]

2024-03-06 Thread Jason Merrill
On 3/4/24 18:30, Nathaniel Shead wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? OK. -- >8 -- In the linked PR the result of 'get_first_fn' is a USING_DECL against the template parameter, to be filled in on instantiation. But we don't actually need to get the first se

Re: [PATCH] c++/modules: member alias tmpl partial inst [PR103994]

2024-03-06 Thread Jason Merrill
On 3/4/24 17:26, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- Alias templates are weird in that their specializations can appear in both decl_specializations and type_specializations. They appear in the latter only at parse time

Re: [PATCH] c++: ICE with variable template and [[deprecated]] [PR110031]

2024-03-06 Thread Jason Merrill
On 3/4/24 17:11, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk/13? OK. -- >8 -- lookup_and_finish_template_variable already has and uses the complain parameter but it is not passing it down to mark_used so we got the default tf_warning_or_error, which causes

Re: [PATCH] c++: lambda capturing structured bindings [PR85889]

2024-03-06 Thread Jason Merrill
On 3/4/24 12:49, Marek Polacek wrote: On Fri, Mar 01, 2024 at 07:58:24PM -0500, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for 15? (Or even trunk?) -- >8 -- clarifies that it's OK to capture structured bindings. [expr.prim.lambda.capture

Re: [PATCH v2] c++: Redetermine whether to write vtables on stream-in [PR114229]

2024-03-07 Thread Jason Merrill
On 3/7/24 07:49, Nathaniel Shead wrote: On Wed, Mar 06, 2024 at 08:59:16AM -0500, Jason Merrill wrote: On 3/5/24 22:06, Nathaniel Shead wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? -- >8 -- Currently, reading a variable definition always marks that decl

Re: [PATCH] c++/modules: inline namespace abi_tag streaming [PR110730]

2024-03-07 Thread Jason Merrill
On 3/6/24 21:12, Patrick Palka wrote: On Wed, 6 Mar 2024, Jason Merrill wrote: On 3/6/24 14:10, Patrick Palka wrote: Tested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- The unreduced testcase from this PR crashes at runtime ultimately because we don't stream the

Re: [PATCH] c++/modules: member alias tmpl partial inst [PR103994]

2024-03-07 Thread Jason Merrill
On 3/7/24 14:41, Patrick Palka wrote: On Thu, 7 Mar 2024, Patrick Palka wrote: On Wed, 6 Mar 2024, Jason Merrill wrote: On 3/4/24 17:26, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- Alias templates are weird in that th

Re: [PATCH] c++: problematic assert in reference_binding [PR113141]

2024-03-07 Thread Jason Merrill
On 1/29/24 17:42, Patrick Palka wrote: On Mon, 29 Jan 2024, Patrick Palka wrote: On Fri, 26 Jan 2024, Jason Merrill wrote: On 1/26/24 17:11, Jason Merrill wrote: On 1/26/24 16:52, Jason Merrill wrote: On 1/25/24 14:18, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu

Re: [PATCH v2] c++: Check module attachment instead of just purview when necessary [PR112631]

2024-03-08 Thread Jason Merrill
On 3/7/24 21:55, Nathaniel Shead wrote: On Mon, Nov 27, 2023 at 03:59:39PM +1100, Nathaniel Shead wrote: On Thu, Nov 23, 2023 at 03:03:37PM -0500, Nathan Sidwell wrote: On 11/20/23 04:47, Nathaniel Shead wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu. I don't have write access. -- >

Re: [PATCH v2] c++: Check module attachment instead of just purview when necessary [PR112631]

2024-03-11 Thread Jason Merrill
On 3/8/24 18:18, Nathaniel Shead wrote: On Fri, Mar 08, 2024 at 10:19:52AM -0500, Jason Merrill wrote: On 3/7/24 21:55, Nathaniel Shead wrote: On Mon, Nov 27, 2023 at 03:59:39PM +1100, Nathaniel Shead wrote: On Thu, Nov 23, 2023 at 03:03:37PM -0500, Nathan Sidwell wrote: On 11/20/23 04:47

Re: [PATCH v2] testsuite: xfail test for short_enums

2024-03-12 Thread Jason Merrill
On 3/11/24 06:23, Torbjörn SVENSSON wrote: Changes compared to v1: - Added reference to r14-6517-gb7e4a4c626e in dg-bogus comment - Changed arm-*-* to short_enums in target selector - Updated commit message to align with above changes As the entire block generating the warning was removed in r1

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