Re: [PATCH] c++: warn about using keywords as identifiers [PR106111]

2022-07-01 Thread Jason Merrill via Gcc-patches
On 6/29/22 12:11, Marek Polacek wrote: In C++03, -Wc++11-compat should warn about int constexpr; since 'constexpr' is a keyword in C++11. Jonathan reports that we don't emit a similar warning for 'alignas' or 'alignof', and, as I found out, 'thread_local'. Similarly, we don't warn for most

Re: [PATCH v2] c++: fix broken copy elision with nested TARGET_EXPRs [PR105550]

2022-07-01 Thread Jason Merrill via Gcc-patches
On 6/24/22 20:30, Marek Polacek wrote: On Thu, Jun 02, 2022 at 05:08:54PM -0400, Jason Merrill wrote: On 5/26/22 11:01, Marek Polacek wrote: In this problem, we are failing to properly perform copy elision with a conditional operator, so this: constexpr A a = true ? A{} : A{}; fails with:

Re: Ping^2: [PATCH v2] diagnostics: Honor #pragma GCC diagnostic in the preprocessor [PR53431]

2022-07-01 Thread Jason Merrill via Gcc-patches
On 6/29/22 12:59, Jason Merrill wrote: On 6/23/22 13:03, Lewis Hyatt via Gcc-patches wrote: Hello- https://gcc.gnu.org/pipermail/gcc-patches/2022-May/595556.html https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431#c49 Would a C++ maintainer have some time to take a look at this patch please? I

Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-01 Thread Jason Merrill via Gcc-patches
On 6/29/22 13:42, Patrick Palka wrote: In r13-1045-gcb7fd1ea85feea I assumed that substitution into generic DECL_TI_ARGS corresponds to an identity mapping of the given arguments, and hence its safe to always elide such substitution. But this PR demonstrates that such a substitution isn't always

Re: Ping^2: [PATCH v2] diagnostics: Honor #pragma GCC diagnostic in the preprocessor [PR53431]

2022-07-01 Thread Jason Merrill via Gcc-patches
On 7/1/22 18:05, Lewis Hyatt wrote: On Fri, Jul 1, 2022 at 3:59 PM Jason Merrill wrote: On 6/29/22 12:59, Jason Merrill wrote: On 6/23/22 13:03, Lewis Hyatt via Gcc-patches wrote: Hello- https://gcc.gnu.org/pipermail/gcc-patches/2022-May/595556.html https://gcc.gnu.org/bugzilla/show_bug.cgi

Re: [PATCH] c-family: Prevent -Wformat warnings with u8 strings [PR105626]

2022-07-05 Thread Jason Merrill via Gcc-patches
On 7/5/22 15:26, Marek Polacek wrote: The thread seems to have concluded that -Wformat shouldn't warn about printf((const char*) u8"test %d\n", 1); saying "format string is not an array of type 'char'". This code is not an aliasing vi

Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-05 Thread Jason Merrill via Gcc-patches
On 7/5/22 10:06, Patrick Palka wrote: On Fri, 1 Jul 2022, Jason Merrill wrote: On 6/29/22 13:42, Patrick Palka wrote: In r13-1045-gcb7fd1ea85feea I assumed that substitution into generic DECL_TI_ARGS corresponds to an identity mapping of the given arguments, and hence its safe to always elide

Re: [PATCH] c++, v3: Add support for __real__/__imag__ modifications in constant expressions [PR88174]

2022-07-05 Thread Jason Merrill via Gcc-patches
On 7/4/22 11:50, Jakub Jelinek wrote: On Mon, Jun 27, 2022 at 06:31:18PM +0200, Jakub Jelinek via Gcc-patches wrote: Hmm, why do we need to handle complex in the !preeval case? I'd think we want to preevaluate all complex values or components thereof. Because the late evaluation of the ini

Re: [PATCH RFA] ubsan: do return check with -fsanitize=unreachable

2022-07-05 Thread Jason Merrill via Gcc-patches
On 6/29/22 13:26, Jakub Jelinek wrote: On Wed, Jun 29, 2022 at 12:42:04PM -0400, Jason Merrill wrote: The usual case is that people just use -fsanitize=undefined and get both return and unreachable sanitization, for fall through into end of functions returning non-void done through return saniti

[pushed] c++: dependent conversion operator lookup [PR106179]

2022-07-05 Thread Jason Merrill via Gcc-patches
This testcase demonstrates that my assumption that we would only be interested in a class template lookup if the template-id is followed by :: was wrong. PR c++/106179 PR c++/106024 gcc/cp/ChangeLog: * parser.cc (cp_parser_lookup_name): Remove :: requirement for u

Re: Ping^2: [PATCH v2] diagnostics: Honor #pragma GCC diagnostic in the preprocessor [PR53431]

2022-07-06 Thread Jason Merrill via Gcc-patches
On 7/6/22 10:23, Lewis Hyatt wrote: On Fri, Jul 01, 2022 at 08:23:53PM -0400, Jason Merrill wrote: On 7/1/22 18:05, Lewis Hyatt wrote: On Fri, Jul 1, 2022 at 3:59 PM Jason Merrill wrote: On 6/29/22 12:59, Jason Merrill wrote: On 6/23/22 13:03, Lewis Hyatt via Gcc-patches wrote: Hello- htt

Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-06 Thread Jason Merrill via Gcc-patches
On 7/6/22 15:26, Patrick Palka wrote: On Tue, 5 Jul 2022, Jason Merrill wrote: On 7/5/22 10:06, Patrick Palka wrote: On Fri, 1 Jul 2022, Jason Merrill wrote: On 6/29/22 13:42, Patrick Palka wrote: In r13-1045-gcb7fd1ea85feea I assumed that substitution into generic DECL_TI_ARGS corresponds

[pushed] c++: -Woverloaded-virtual and dtors [PR87729]

2022-07-07 Thread Jason Merrill via Gcc-patches
My earlier patch broke out of the loop over base members when we found a match, but that caused trouble for dtors, which can have multiple for which same_signature_p is true. But as the function comment says, we know this doesn't apply to [cd]tors, so skip them. Tested x86_64-pc-linux-gnu, applyi

Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-07 Thread Jason Merrill via Gcc-patches
On 7/7/22 11:16, Patrick Palka wrote: On Thu, 7 Jul 2022, Jason Merrill wrote: On 7/6/22 15:26, Patrick Palka wrote: On Tue, 5 Jul 2022, Jason Merrill wrote: On 7/5/22 10:06, Patrick Palka wrote: On Fri, 1 Jul 2022, Jason Merrill wrote: On 6/29/22 13:42, Patrick Palka wrote: In r13-1045-

Re: [PATCH] c++: Define built-in for std::tuple_element [PR100157]

2022-07-07 Thread Jason Merrill via Gcc-patches
On 7/7/22 13:14, Jonathan Wakely wrote: This adds a new built-in to replace the recursive class template instantiations done by traits such as std::tuple_element and std::variant_alternative. The purpose is to select the Nth type from a list of types, e.g. __builtin_type_pack_element(1, char, int

Re: [PATCH] c++: non-dependent call to consteval operator [PR105912]

2022-07-12 Thread Jason Merrill via Gcc-patches
On 7/11/22 21:27, Patrick Palka wrote: Here we were crashing when substituting a non-dependent call to a consteval operator, whose CALL_EXPR_OPERATOR_SYNTAX flag we try to propagate to the result, but the result isn't a CALL_EXPR since the called function is consteval. This patch fixes this by c

Re: [PATCH] c++: dependence of constrained memfn from current inst [PR105842]

2022-07-12 Thread Jason Merrill via Gcc-patches
On 7/11/22 09:33, Patrick Palka wrote: Here we incorrectly deem the calls to func1, func2 and tmpl2 as ambiguous ahead of time ultimately because we mishandle dependence of a constrained member function from the current instantiation. In type_dependent_expression_p, we consider the dependence of

Re: [PATCH] c++: Add __reference_con{struc,ver}ts_from_temporary [PR104477]

2022-07-12 Thread Jason Merrill via Gcc-patches
On 7/8/22 13:41, Marek Polacek wrote: This patch implements C++23 P2255R2, which adds two new type traits to detect reference binding to a temporary. They can be used to detect code like std::tuple t("meow"); which is incorrect because it always creates a dangling reference, because the std

Re: [PATCH] c++: Add __reference_con{struc,ver}ts_from_temporary [PR104477]

2022-07-12 Thread Jason Merrill via Gcc-patches
On 7/12/22 16:10, Jason Merrill wrote: On 7/8/22 13:41, Marek Polacek wrote: This patch implements C++23 P2255R2, which adds two new type traits to detect reference binding to a temporary.  They can be used to detect code like    std::tuple t("meow"); which is incorrect because it always creat

Re: [PATCH] c++: Add __reference_con{struc,ver}ts_from_temporary [PR104477]

2022-07-14 Thread Jason Merrill via Gcc-patches
On 7/14/22 13:43, Marek Polacek wrote: On Tue, Jul 12, 2022 at 04:15:00PM -0400, Jason Merrill wrote: On 7/12/22 16:10, Jason Merrill wrote: On 7/8/22 13:41, Marek Polacek wrote: This patch implements C++23 P2255R2, which adds two new type traits to detect reference binding to a temporary.  Th

Re: [PATCH] c++: shortcut bad reference bindings [PR94894]

2022-07-18 Thread Jason Merrill via Gcc-patches
On 7/18/22 12:59, Patrick Palka wrote: In case of l/rvalue or cv-qual mismatch during reference binding, we try to give more helpful diagnostics by attempting a bad conversion that ignores the mismatch. But in doing so, we may end up instantiating an ill-formed conversion function, something tha

Re: [PATCH] c++: Enable __has_builtin for new reference binding built-ins

2022-07-19 Thread Jason Merrill via Gcc-patches
On 7/19/22 09:11, Jonathan Wakely wrote: Tested x86_64-linux, OK for trunk? OK. -- >8 -- The new built-ins need to be detectable using __has_builtin, and the library should use that to check for them. This fixes an error with Clang when C++23 is enabled. gcc/cp/ChangeLog: * cp-obj

[pushed] c++: defaulted ctor with DMI in union [PR94823]

2022-07-21 Thread Jason Merrill via Gcc-patches
CWG2084 clarifies that a variant member with a non-trivial constructor does not make the union's defaulted default constructor deleted if another variant member has a default member initializer. Tested x86_64-pc-linux-gnu, applying to trunk. DR 2084 PR c++/94823 gcc/cp/ChangeLog:

[pushed] c++: defaulted friend op== [PR106361]

2022-07-21 Thread Jason Merrill via Gcc-patches
Now non-member functions can be defaulted, so this assert is wrong. move_signature_fn_p already checks for ctor or op=. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/106361 gcc/cp/ChangeLog: * decl.cc (move_fn_p): Remove assert. gcc/testsuite/ChangeLog: * g++.d

Re: [PATCH] c++: ICE with erroneous template redeclaration [PR106311]

2022-07-22 Thread Jason Merrill via Gcc-patches
On 7/15/22 11:29, Marek Polacek wrote: Here we ICE trying to get DECL_SOURCE_LOCATION of the parm that happens to be error_mark_node in this ill-formed test. I kept running into this while reducing code, so it'd be good to have it fixed. Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for tru

Re: [PATCH] c++: Refer to internal linkage for -Wsubobject-linkage [PR86491]

2022-07-22 Thread Jason Merrill via Gcc-patches
On 6/30/22 12:53, Jonathan Wakely via Gcc-patches wrote: Tested powerpc64le-linux, OK for trunk? -- >8 -- Since C++11 relaxed the requirement for template arguments to have external linkage, it's possible to get -Wsubobject-linkage warnings without using any anonymous namespaces. This confuses

Re: [PATCH] c++: CTAD from initializer list [PR106366]

2022-07-22 Thread Jason Merrill via Gcc-patches
On 7/21/22 08:43, Patrick Palka wrote: During CTAD, we currently perform the first phase of overload resolution from [over.match.list] only if the class template has a list constructor. But according to [over.match.class.deduct]/4 it should be enough to just have a guide that looks like a list co

[pushed] c++: -Woverloaded-virtual false positive [PR87729]

2022-07-25 Thread Jason Merrill via Gcc-patches
My attempt to shortcut unnecessary checking after finding a match was also wrong for multiple inheritance, so let's give up on it. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/87729 gcc/cp/ChangeLog: * class.cc (warn_hidden): Remove shortcut. gcc/testsuite/ChangeLog:

[pushed] c++: aggregate prvalue as for range [PR106230]

2022-07-25 Thread Jason Merrill via Gcc-patches
Since my PR94041 work on temporary lifetime in aggregate initialization, we end up calling build_vec_init to initialize the reference-extended temporary for the artificial __for_range variable. And build_vec_init uses finish_for_stmt to implement its loop. That function assumes that if __for_rang

Re: [v2 PATCH] c++: ICE with erroneous template redeclaration [PR106311]

2022-07-25 Thread Jason Merrill via Gcc-patches
On 7/25/22 14:43, Marek Polacek wrote: On Fri, Jul 22, 2022 at 05:21:58PM -0400, Jason Merrill wrote: On 7/15/22 11:29, Marek Polacek wrote: Here we ICE trying to get DECL_SOURCE_LOCATION of the parm that happens to be error_mark_node in this ill-formed test. I kept running into this while red

Re: [PATCH] c-family: Honor -Wno-init-self for cv-qual vars [PR102633]

2022-07-26 Thread Jason Merrill via Gcc-patches
On 7/26/22 15:03, Marek Polacek wrote: Since r11-5188-g32934a4f45a721, we drop qualifiers during l-to-r conversion by creating a NOP_EXPR. For e.g. const int i = i; that means that the DECL_INITIAL is '(int) i' and not 'i' anymore. Consequently, we don't suppress_warning here: 711 case

[pushed] c++: constexpr, empty base after non-empty [PR106369]

2022-07-30 Thread Jason Merrill via Gcc-patches
Here the CONSTRUCTOR we were providing for D{} had an entry for the B base subobject at offset 0 following the entry for the C base, causing output_constructor_regular_field to ICE due to going backwards. It might be nice for that function to be more tolerant of empty fields, but it also seems rea

Re: [PATCH] c-family: Honor -Wno-init-self for cv-qual vars [PR102633]

2022-08-06 Thread Jason Merrill via Gcc-patches
On 7/26/22 14:31, Marek Polacek wrote: On Tue, Jul 26, 2022 at 04:24:18PM -0400, Jason Merrill wrote: On 7/26/22 15:03, Marek Polacek wrote: Since r11-5188-g32934a4f45a721, we drop qualifiers during l-to-r conversion by creating a NOP_EXPR. For e.g. const int i = i; that means that the D

Re: [PATCH] gimple, internal-fn: Add IFN_TRAP and use it for __builtin_unreachable [PR106099]

2022-08-06 Thread Jason Merrill via Gcc-patches
On 7/27/22 03:09, Richard Biener wrote: On Wed, 27 Jul 2022, Jakub Jelinek wrote: On Wed, Jul 27, 2022 at 09:33:47AM +, Richard Biener wrote: __builtin_unreachable and __ubsan_handle_builtin_unreachable don't use vops, they are marked const/leaf/noreturn/nothrow/cold. But __builtin_trap us

Re: [PATCH] c++, v4: Add support for __real__/__imag__ modifications in constant expressions [PR88174]

2022-08-06 Thread Jason Merrill via Gcc-patches
On 7/27/22 02:09, Jakub Jelinek wrote: On Tue, Jul 05, 2022 at 04:44:41PM -0400, Jason Merrill wrote: But preeval should always be true, so we'd never reach the new handling in the if (!preeval) block. Certainly the new testcase doesn't exercise this code. Ok, changed now. I had to keep the

Re: [PATCH] c++: Extend -Wpessimizing-move for class prvalues [PR106276]

2022-08-06 Thread Jason Merrill via Gcc-patches
On 7/27/22 17:14, Marek Polacek wrote: We already have a warning that warns about pessimizing std::move in a return statement, when it prevents the NRVO: T fn() { T t; return std::move (t); // warning \o/ } However, the warning doesn't warn when what we are returning is a cla

Re: [PATCH] c++: Tweak for -Wpessimizing-move in templates [PR89780]

2022-08-06 Thread Jason Merrill via Gcc-patches
On 8/4/22 11:46, Marek Polacek wrote: In my previous patches I've been extending our std::move warnings, but this tweak actually dials it down a little bit. As reported in bug 89780, it's questionable to warn about expressions in templates that were type-dependent, but aren't anymore because we'

Re: [PATCH] c++: Extend -Wpessimizing-move for class prvalues [PR106276]

2022-08-06 Thread Jason Merrill via Gcc-patches
On 8/6/22 15:49, Jason Merrill wrote: On 7/27/22 17:14, Marek Polacek wrote: We already have a warning that warns about pessimizing std::move in a return statement, when it prevents the NRVO:    T fn()    { T t; return std::move (t); // warning \o/    } However, the warning doesn't w

Re: [PATCH] c++: Extend -Wredundant-move for const-qual objects [PR90428]

2022-08-06 Thread Jason Merrill via Gcc-patches
On 8/6/22 11:13, Marek Polacek wrote: In this PR, Jon suggested extending the -Wredundant-move warning to warn when the user is moving a const object as in: struct T { }; T f(const T& t) { return std::move(t); } where the std::move is redundant, because T does not have a T(con

Re: [PATCH v2] c-family: Honor -Wno-init-self for cv-qual vars [PR102633]

2022-08-10 Thread Jason Merrill via Gcc-patches
On 8/8/22 12:06, Marek Polacek wrote: On Sat, Aug 06, 2022 at 03:29:05PM -0700, Jason Merrill wrote: On 7/26/22 14:31, Marek Polacek wrote: On Tue, Jul 26, 2022 at 04:24:18PM -0400, Jason Merrill wrote: On 7/26/22 15:03, Marek Polacek wrote: Since r11-5188-g32934a4f45a721, we drop qualifiers

Re: [PATCH] c++: follow DR 2386 and update implementation of get_tuple_size [PR110216]

2023-08-08 Thread Jason Merrill via Gcc-patches
On 8/6/23 14:15, gnaggnoyil wrote: DR 2386 updated the tuple_size requirements for structured binding and it now requires tuple_size to be considered only if std::tuple_size names a complete class type with member value. GCC before this patch does not follow the updated requrements, and this patc

Re: [PATCH] c++: Report invalid id-expression in decltype [PR100482]

2023-08-08 Thread Jason Merrill via Gcc-patches
On 8/7/23 22:48, Nathaniel Shead wrote: Sorry, noticed I provided the wrong version of the test. Here is the correct version (not relying on 'namespace std' being implicitly defined). Bootstrapped + regtested on x86_64-pc-linux-gnu. Pushed, thanks! -- 8< -- This patch ensures that any errors

Re: [RFC] c++: extend cold, hot attributes to classes

2023-08-08 Thread Jason Merrill via Gcc-patches
On 8/3/23 07:07, Javier Martinez via Gcc-patches wrote: Most code is cold. This patch extends support for attribute ((cold)) to C++ Classes, Unions, and Structs (RECORD_TYPES and UNION_TYPES) to benefit from encapsulation - reducing the verbosity of using the attribute where deserved. The ((hot))

Re: [PATCH 04/14] c++: use _P() defines from tree.h

2023-08-08 Thread Jason Merrill via Gcc-patches
On 8/2/23 12:51, Patrick Palka via Gcc-patches wrote: On Thu, Jun 1, 2023 at 2:11 PM Bernhard Reutner-Fischer wrote: Hi David, Patrick, On Thu, 1 Jun 2023 18:33:46 +0200 Bernhard Reutner-Fischer wrote: On Thu, 1 Jun 2023 11:24:06 -0400 Patrick Palka wrote: On Sat, May 13, 2023 at 7:26 P

Re: [PATCH] c++: improve debug_tree for templated types/decls

2023-08-08 Thread Jason Merrill via Gcc-patches
On 7/31/23 20:34, Patrick Palka wrote: Tested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- gcc/cp/ChangeLog: * ptree.cc (cxx_print_decl): Check for DECL_LANG_SPECIFIC and TS_DECL_COMMON only when necessary. Print DECL_TEMPLATE_INFO for all decls that h

Re: [PATCH] c++: parser cleanup, remove dummy arguments

2023-08-08 Thread Jason Merrill via Gcc-patches
On 7/31/23 17:52, Marek Polacek wrote: Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- Now that cp_parser_constant_expression accepts a null non_constant_p, we can transitively remove dummy arguments in the call chain. Running dg.exp and counting the # of is_rvalue_consta

Re: [PATCH] preprocessor: c++: Support `#pragma GCC target' macros [PR87299]

2023-08-08 Thread Jason Merrill via Gcc-patches
On 7/31/23 22:22, Lewis Hyatt via Gcc-patches wrote: `#pragma GCC target' is not currently handled in preprocess-only mode (e.g., when running gcc -E or gcc -save-temps). As noted in the PR, this means that if the target pragma defines any macros, those macros are not effective in preprocess-only

Re: [PATCH] c++: bogus warning w/ deduction guide in anon ns [PR106604]

2023-08-10 Thread Jason Merrill via Gcc-patches
On 8/10/23 12:09, Patrick Palka wrote: Booststrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk and perhaps 13? -- >8 -- We shouldn't issue a "declared static but never defined" warning for a deduction guide (declared in an anonymous namespace). PR c++/106604 gc

Re: [RFC PATCH v2] c++: extend cold, hot attributes to classes

2023-08-10 Thread Jason Merrill via Gcc-patches
On 8/10/23 14:06, Javier Martinez wrote: Thanks for the comments, Jason. v2: + Fix formatting, remove unnecessarily warning. On Tue, Aug 8, 2023 at 10:28 PM Jason Merrill > wrote: > Seems reasonable, but how do you expect this to be used? We have large applications wh

Re: [PATCH] c++: improve debug_tree for templated types/decls

2023-08-10 Thread Jason Merrill via Gcc-patches
On 8/10/23 16:59, Patrick Palka wrote: On Tue, 8 Aug 2023, Jason Merrill wrote: On 7/31/23 20:34, Patrick Palka wrote: Tested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- gcc/cp/ChangeLog: * ptree.cc (cxx_print_decl): Check for DECL_LANG_SPECIFIC and TS_DECL

Re: [PATCH] c++: bogus warning w/ deduction guide in anon ns [PR106604]

2023-08-10 Thread Jason Merrill via Gcc-patches
On 8/10/23 16:40, Patrick Palka wrote: On Thu, 10 Aug 2023, Jason Merrill wrote: On 8/10/23 12:09, Patrick Palka wrote: Booststrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk and perhaps 13? -- >8 -- We shouldn't issue a "declared static but never defined" warning fo

Re: [PATCH] c++: recognize in-class var tmpl partial spec [PR71954]

2023-08-10 Thread Jason Merrill via Gcc-patches
On 8/10/23 12:08, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? OK. -- >8 -- This makes us recognize variable template partial specializations defined directly inside the class body. It seems to suffice to call check_explicit_specializa

Re: [PATCH] c++: dependently scoped template-id in type-req [PR110927]

2023-08-10 Thread Jason Merrill via Gcc-patches
On 8/10/23 12:08, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk and perhaps 13? OK. -- >8 -- Here we're incorrectly rejecting the first type-requirement at parse time with concepts-requires35.C:14:56: error: ‘typename A::B’ is not a t

Re: [PATCH] c, c++, v2: Accept __builtin_classify_type (typename)

2023-08-10 Thread Jason Merrill via Gcc-patches
On 8/10/23 11:35, Jakub Jelinek wrote: Hi! I'd like to ping this patch. Reposting it as I found a typo in the documentation - s/builtin-in/built-in/. Bootstrapped/regtested again on x86_64-linux and i686-linux, ok for trunk? On Mon, Jun 12, 2023 at 09:57:17PM +0200, Jakub Jelinek via Gcc-patc

Re: [PATCH] c++: bogus warning w/ deduction guide in anon ns [PR106604]

2023-08-11 Thread Jason Merrill via Gcc-patches
On 8/11/23 09:54, Patrick Palka wrote: On Thu, 10 Aug 2023, Jason Merrill wrote: On 8/10/23 16:40, Patrick Palka wrote: On Thu, 10 Aug 2023, Jason Merrill wrote: On 8/10/23 12:09, Patrick Palka wrote: Booststrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk and perhap

Re: [PATCH] c, c++, v2: Accept __builtin_classify_type (typename)

2023-08-11 Thread Jason Merrill via Gcc-patches
On 8/11/23 04:48, Jakub Jelinek wrote: On Fri, Aug 11, 2023 at 01:13:32AM +0200, Jakub Jelinek wrote: Looking at the first uses of the builtin back in 90s in va*.h, it certainly relied on array/function decay there (the macros would abort e.g. on array_type_class, function_type_class and various

Re: [PATCH] tree-pretty-print: delimit TREE_VEC with braces

2023-08-11 Thread Jason Merrill via Gcc-patches
On 8/11/23 13:35, Patrick Palka wrote: Tested on x86_64-pc-linux-gnu, does this look OK for trunk? OK. -- >8 -- This makes the generic pretty printer print braces around a TREE_VEC like we do for CONSTRUCTOR. This should improve readability of nested TREE_VECs in particular. gcc/ChangeLog:

[pushed] c++: -fconcepts and __cpp_concepts

2023-08-14 Thread Jason Merrill via Gcc-patches
Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- Since -fconcepts no longer implies -fconcepts-ts, we shouldn't advertise TS support with __cpp_concepts=201507L. Also fix one case where -std=c++14 -fconcepts wasn't working (as found by range-v3 calendar). Fixing other cases is not a prio

Re: [PATCH v1] c++: follow DR 2386 and update implementation of get_tuple_size [PR110216]

2023-08-14 Thread Jason Merrill via Gcc-patches
On 8/12/23 04:16, gnaggnoyil wrote: DR 2386 updated the tuple_size requirements for structured binding and it now requires tuple_size to be considered only if std::tuple_size names a complete class type with member value. GCC before this patch does not follow the updated requrements, and this pat

Re: [PATCH v3] c++: extend cold, hot attributes to classes

2023-08-14 Thread Jason Merrill via Gcc-patches
On 8/11/23 09:18, Javier Martinez wrote: Hi Jason, Regarding the initialization example - no, the set of classes that we consider cold is more loosely defined. On Thu, Aug 10, 2023 at 11:01 PM Jason Merrill > wrote: > Yes, but that's because the implicit op== isn't

Re: [PATCH v3] c++: Accept elaborated-enum-base with pedwarn

2023-06-16 Thread Jason Merrill via Gcc-patches
On 6/16/23 07:58, Alex Coplan wrote: Hi, This is a v3 patch addressing feedback for: https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621714.html The only change since the previous version is that the new option is documented in invoke.texi (and the description in c.opt was shortened as requ

Re: [PATCH] c++: diagnostic ICE b/c of empty TPARMS_PRIMARY_TEMPLATE [PR109655]

2023-06-16 Thread Jason Merrill via Gcc-patches
On 6/9/23 11:19, Patrick Palka wrote: When defining a previously declared class template, we neglect to set TPARMS_PRIMARY_TEMPLATE for the in-scope template parameters, which the class members go on to inherit, and so the members' DECL_TEMPLATE_PARMS will have empty TPARMS_PRIMARY_TEMPLATE at th

Re: [PATCH v6 0/4] P1689R5 support

2023-06-16 Thread Jason Merrill via Gcc-patches
On Fri, Jun 16, 2023 at 3:49 PM Ben Boeckel wrote: > > On Thu, Jun 08, 2023 at 21:59:13 +0400, Maxim Kuvyrkov wrote: > > This patch series causes ICEs on arm-linux-gnueabihf. Would you > > please investigate? Please let me know if you need any in reproducing > > these. > > Finally back at it. I

Re: [PATCH] debug/110295 - mixed up early/late debug for member DIEs

2023-06-19 Thread Jason Merrill via Gcc-patches
On 6/19/23 06:15, Richard Biener wrote: When we process a scope typedef during early debug creation and we have already created a DIE for the type when the decl is TYPE_DECL_IS_STUB and this DIE is still in limbo we end up just re-parenting that type DIE instead of properly creating a DIE for the

Re: [PATCH v5 3/5] p1689r5: initial support

2023-06-19 Thread Jason Merrill via Gcc-patches
On 5/12/23 10:24, Ben Boeckel wrote: On Tue, Feb 14, 2023 at 16:50:27 -0500, Jason Merrill wrote: I notice that the actual flags are all -fdep-*, though some of them are -fdeps-* here, and the internal variables all seem to be fdeps_*. I lean toward harmonizing on "deps", I think. Done. I d

Re: [PATCH v6 1/4] libcpp: reject codepoints above 0x10FFFF

2023-06-19 Thread Jason Merrill via Gcc-patches
On 6/6/23 16:50, Ben Boeckel wrote: Unicode does not support such values because they are unrepresentable in UTF-16. Pushed. libcpp/ * charset.cc: Reject encodings of codepoints above 0x10. UTF-16 does not support such codepoints and therefore all Unicode rejects

Re: [PATCH v6 0/4] P1689R5 support

2023-06-19 Thread Jason Merrill via Gcc-patches
On 6/17/23 10:43, Ben Boeckel wrote: On Fri, Jun 16, 2023 at 23:55:53 -0400, Jason Merrill wrote: I see the same thing with patch 4 on x86_64-pc-linux-gnu, e.g. FAIL: g++.dg/modules/ben-1_a.C -std=c++17 (test for excess errors) Excess errors: /home/jason/gt/gcc/testsuite/g++.dg/modules/ben-1_a.

[pushed] wwwdocs: Add GCC Code of Conduct

2023-06-20 Thread Jason Merrill via Gcc-patches
As announced on gcc@. --- htdocs/bugs/index.html | 3 + htdocs/conduct-faq.html | 66 htdocs/conduct-report.html | 122 ++ htdocs/conduct-response.html | 141 +++ htdocs/conduct.html | 118 ++

Re: [PATCH v5 4/5] c++modules: report imported CMI files as dependencies

2023-06-22 Thread Jason Merrill via Gcc-patches
On 1/25/23 16:06, Ben Boeckel wrote: They affect the build, so report them via `-MF` mechanisms. Why isn't this covered by the existing code in preprocessed_module? gcc/cp/ * module.cc (do_import): Report imported CMI files as dependencies. Signed-off-by: Ben Boeckel ---

Re: [PATCH v5 5/5] c++modules: report module mapper files as a dependency

2023-06-23 Thread Jason Merrill via Gcc-patches
On 1/25/23 16:06, Ben Boeckel wrote: It affects the build, and if used as a static file, can reliably be tracked using the `-MF` mechanism. Hmm, this seems a bit like making all .o depend on the Makefile; it shouldn't be necessary to rebuild all TUs that use modules when we add another module

Re: [PATCH] c++: Add support for -std={c,gnu}++2{c,6}

2023-06-23 Thread Jason Merrill via Gcc-patches
On 6/22/23 20:25, Marek Polacek wrote: It seems prudent to add C++26 now that the first C++26 papers have been approved. I followed commit r11-6920 as well as r8-3237. I was puzzled to see that -std=c++23 was marked Undocumented but -std=c++2b wasn't. I think it should be the other way round,

Re: [PATCH] c++: redundant targ coercion for var/alias tmpls

2023-06-23 Thread Jason Merrill via Gcc-patches
On 6/21/23 13:19, Patrick Palka wrote: When stepping through the variable/alias template specialization code paths, I noticed we perform template argument coercion twice: first from instantiate_alias_template / finish_template_variable and again from tsubst_decl (during instantiate_template). It

Re: PING: Re: [PATCH] c++: provide #include hint for missing includes [PR110164]

2023-06-23 Thread Jason Merrill via Gcc-patches
On 6/22/23 11:50, Marek Polacek wrote: On Wed, Jun 21, 2023 at 04:44:00PM -0400, David Malcolm via Gcc-patches wrote: I'd like to ping this C++ FE patch for review: https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621779.html Not an approval, but LGTM, though some nits below: On We

Re: [PATCH v5 3/5] p1689r5: initial support

2023-06-23 Thread Jason Merrill via Gcc-patches
On 6/20/23 15:46, Ben Boeckel wrote: On Tue, Feb 14, 2023 at 16:50:27 -0500, Jason Merrill wrote: On 1/25/23 13:06, Ben Boeckel wrote: Header units (including the standard library headers) are 100% unsupported right now because the `-E` mechanism wants to import their BMIs. A new mode (i.e.,

Re: [PATCH v2] c++: Add support for -std={c,gnu}++2{c,6}

2023-06-23 Thread Jason Merrill via Gcc-patches
On 6/23/23 13:22, Marek Polacek wrote: On Fri, Jun 23, 2023 at 10:58:54AM -0400, Jason Merrill wrote: On 6/22/23 20:25, Marek Polacek wrote: It seems prudent to add C++26 now that the first C++26 papers have been approved. I followed commit r11-6920 as well as r8-3237. I was puzzled to see th

Re: [PATCH 1/1] libcpp: allow UCS_LIMIT codepoints in UTF-8 strings

2023-06-23 Thread Jason Merrill via Gcc-patches
On 6/21/23 14:58, Ben Boeckel wrote: libcpp/ * charset.cc: Allow `UCS_LIMIT` in UTF-8 strings. Reported-by: Damien Guibouret Fixes: c1dbaa6656a (libcpp: reject codepoints above 0x10, 2023-06-06) Signed-off-by: Ben Boeckel Applied, moving the Fixes line up and changing the commit

[pushed] testsuite: std_list handling for { target c++26 }

2023-06-27 Thread Jason Merrill via Gcc-patches
Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- As with c++23, we want to run { target c++26 } tests even though it isn't part of the default std_list. C++17 with Concepts TS is no longer an interesting target configuration. And bump the impcx target to use C++26 mode instead of 23. gc

[pushed] c++: C++26 constexpr cast from void* [PR110344]

2023-06-27 Thread Jason Merrill via Gcc-patches
Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- P2768 allows static_cast from void* to ob* in constant evaluation if the pointer does in fact point to an object of the appropriate type. cxx_fold_indirect_ref already does the work of finding such an object if it happens to be a subobject r

[pushed] c++: inherited constructor attributes

2023-06-27 Thread Jason Merrill via Gcc-patches
Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- Inherited constructors are like constructor clones; they don't exist from the language perspective, so they should copy the attributes in the same way. But it doesn't make sense to copy alias or ifunc attributes in either case. Unlike hand

Re: [PATCH] c++: ahead of time variable template-id coercion [PR89442]

2023-06-28 Thread Jason Merrill via Gcc-patches
On 5/3/23 09:50, Patrick Palka wrote: This patch makes us coerce the arguments of a variable template-id ahead of time, as we do for other template-ids, which allows us to immediately diagnose template parameter/argument kind mismatches and arity mismatches. Unfortunately this causes a regressio

Re: [PATCH] c++: ahead of time variable template-id coercion [PR89442]

2023-06-28 Thread Jason Merrill via Gcc-patches
On 6/28/23 11:28, Jason Merrill wrote: On 5/3/23 09:50, Patrick Palka wrote: This patch makes us coerce the arguments of a variable template-id ahead of time, as we do for other template-ids, which allows us to immediately diagnose template parameter/argument kind mismatches and arity mismatche

Re: [PATCH] c++: redundant targ coercion for var/alias tmpls

2023-06-28 Thread Jason Merrill via Gcc-patches
On 6/23/23 12:23, Patrick Palka wrote: On Fri, 23 Jun 2023, Jason Merrill wrote: On 6/21/23 13:19, Patrick Palka wrote: When stepping through the variable/alias template specialization code paths, I noticed we perform template argument coercion twice: first from instantiate_alias_template / fi

Re: [PATCH] c++: fix error reporting routines re-entered ICE [PR110175]

2023-06-28 Thread Jason Merrill via Gcc-patches
On 6/23/23 18:25, Marek Polacek wrote: Here we get the "error reporting routines re-entered" ICE because of an unguarded use of warning_at. While at it, I added a check for a warning_at just above it. Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? OK. PR c++/110175 gc

Re: [PATCH] c++: cache partial template specialization selection

2023-06-28 Thread Jason Merrill via Gcc-patches
On 6/28/23 12:51, Patrick Palka wrote: There's currently no cheap way to obtain the partial template specialization (and arguments relative to it) that was selected for a class or variable template specialization. Our only option is to compute the result from scratch via most_specialized_partial

Re: [PATCH] c++: Fix ICE with parameter pack of decltype(auto) [PR103497]

2023-06-29 Thread Jason Merrill via Gcc-patches
On 6/24/23 09:24, Nathaniel Shead wrote: On Fri, Jun 23, 2023 at 11:59:51AM -0400, Patrick Palka wrote: Hi, On Sat, 22 Apr 2023, Nathaniel Shead via Gcc-patches wrote: Bootstrapped and tested on x86_64-pc-linux-gnu. -- 8< -- This patch raises an error early when the decltype(auto) specifier

Re: [PATCH] c++: NSDMI instantiation during overload resolution [PR110468]

2023-06-29 Thread Jason Merrill via Gcc-patches
On 6/29/23 11:22, Patrick Palka wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk/13/12? OK. -- >8 -- Here we find ourselves instantiating the NSDMI for A<1>::m when computing argument conversions during overload resolution, and thus tf_conv is set. This

Re: [PATCH] c++: unpropagated CONSTRUCTOR_MUTABLE_POISON [PR110463]

2023-06-29 Thread Jason Merrill via Gcc-patches
On 6/29/23 11:36, Marek Polacek wrote: On Thu, Jun 29, 2023 at 11:22:55AM -0400, Patrick Palka via Gcc-patches wrote: Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk/13? -- >8 -- cp_fold is neglecting to propagate CONSTRUCTOR_MUTABLE_POISON when folding a CONSTRU

Re: [PATCH 2/19][front-end] C/C++ front-end: add pragma GCC novector

2023-06-29 Thread Jason Merrill via Gcc-patches
On 6/28/23 09:41, Tamar Christina wrote: Hi All, FORTRAN currently has a pragma NOVECTOR for indicating that vectorization should not be applied to a particular loop. ICC/ICX also has such a pragma for C and C++ called #pragma novector. As part of this patch series I need a way to easily turn

Re: [PATCH] c++: fix up caching of level lowered ttps

2023-06-29 Thread Jason Merrill via Gcc-patches
On 6/1/23 17:42, Patrick Palka wrote: Due to level/depth mismatches between the template parameters of a level lowered ttp and the original ttp, the ttp comparison check added by r14-418-g0bc2a1dc327af9 never actually holds outside of erroneous cases. Moreover, it'd be good to cache the overall T

Re: [PATCH 2/19][front-end] C/C++ front-end: add pragma GCC novector

2023-06-30 Thread Jason Merrill via Gcc-patches
On Fri, Jun 30, 2023, 12:18 PM Tamar Christina wrote: > Hi Jason, > > Thanks for the review. I only now realized I should have split them > between C and C++. > > Will do so on the respins. > > > > > On 6/28/23 09:41, Tamar Christina wrote: > > > Hi All, > > > > > > FORTRAN currently has a pragma

Re: [PATCH] c++: coercing variable template from current inst [PR110580]

2023-07-11 Thread Jason Merrill via Gcc-patches
Ok. On Tue, Jul 11, 2023, 9:16 AM Patrick Palka wrote: > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for > trunk? > > -- >8 -- > > Here during ahead of time coercion of the variable template-id v1, > since we pass only the innermost arguments to coerce_template_parms (an

Re: [PATCH v5 1/5] libcpp: reject codepoints above 0x10FFFF

2023-02-13 Thread Jason Merrill via Gcc-patches
On 1/25/23 13:06, Ben Boeckel wrote: Unicode does not support such values because they are unrepresentable in UTF-16. libcpp/ * charset.cc: Reject encodings of codepoints above 0x10. UTF-16 does not support such codepoints and therefore all Unicode rejects such value

Re: [PATCH v5 4/5] c++modules: report imported CMI files as dependencies

2023-02-13 Thread Jason Merrill via Gcc-patches
On 1/25/23 13:06, Ben Boeckel wrote: They affect the build, so report them via `-MF` mechanisms. gcc/cp/ * module.cc (do_import): Report imported CMI files as dependencies. Both this and the mapper dependency patch seem to cause most of the modules testcases to crash; please

Re: [PATCH v5 3/5] p1689r5: initial support

2023-02-14 Thread Jason Merrill via Gcc-patches
On 1/25/23 13:06, Ben Boeckel wrote: This patch implements support for [P1689R5][] to communicate to a build system the C++20 module dependencies to build systems so that they may build `.gcm` files in the proper order. Thanks again. Support is communicated through the following three new fla

Re: [PATCH] c++: fix ICE in joust_maybe_elide_copy [PR106675]

2023-02-14 Thread Jason Merrill via Gcc-patches
On 2/13/23 09:06, Marek Polacek wrote: joust_maybe_elide_copy checks that the last conversion in the ICS for the first argument is ck_ref_bind, which is reasonable, because we've checked that we're dealing with a copy/move constructor. But it can also happen that we couldn't figure out which con

Re: [PATCH] c++: Add testcases from some Issaquah DRs

2023-02-14 Thread Jason Merrill via Gcc-patches
On 2/14/23 03:33, Jakub Jelinek wrote: On Tue, Feb 14, 2023 at 12:22:33PM +0100, Jakub Jelinek via Gcc-patches wrote: 2023-02-14 Jakub Jelinek * g++.dg/DRs/dr2691.C: New test. Actually, this one isn't a DR, so maybe it should go into: * gcc/testsuite/c-c++-common/cpp/delimi

Re: [PATCH 1/2] c++: factor out TYPENAME_TYPE substitution

2023-02-14 Thread Jason Merrill via Gcc-patches
On 2/13/23 09:23, Patrick Palka wrote: [N.B. this is a corrected version of https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607443.html ] This patch factors out the TYPENAME_TYPE case of tsubst into a separate function tsubst_typename_type. It also factors out the two tsubst flags contr

Re: [PATCH 2/2] c++: TYPENAME_TYPE lookup ignoring non-types [PR107773]

2023-02-14 Thread Jason Merrill via Gcc-patches
On 2/13/23 09:23, Patrick Palka wrote: [N.B. this is a corrected version of https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607443.html ] Currently when resolving a TYPENAME_TYPE for 'typename T::m' via make_typename_type, we consider only type bindings of 'm' and ignore non-type ones.

Re: [PATCH 1/2] c++: factor out TYPENAME_TYPE substitution

2023-02-14 Thread Jason Merrill via Gcc-patches
On 2/14/23 14:15, Jason Merrill wrote: On 2/13/23 09:23, Patrick Palka wrote: [N.B. this is a corrected version of https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607443.html ] This patch factors out the TYPENAME_TYPE case of tsubst into a separate function tsubst_typename_type.  It als

Re: [PATCH 2/2] c++: speculative constexpr and is_constant_evaluated [PR108243]

2023-02-14 Thread Jason Merrill via Gcc-patches
On 2/10/23 08:51, Patrick Palka wrote: On Fri, 10 Feb 2023, Patrick Palka wrote: On Thu, 9 Feb 2023, Patrick Palka wrote: On Thu, 9 Feb 2023, Jason Merrill wrote: On 2/9/23 09:36, Patrick Palka wrote: On Sun, 5 Feb 2023, Jason Merrill wrote: On 2/3/23 15:51, Patrick Palka wrote: On Mon,

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