This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA (make_dispatcher_decl): PATCH for c++/83911, ICE with multiversioned constructor


On Fri, Mar 16, 2018 at 8:38 AM, Jason Merrill <jason@redhat.com> wrote:
> On Thu, Mar 15, 2018 at 4:50 AM, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> On Wed, Mar 14, 2018 at 8:57 PM, Jason Merrill <jason@redhat.com> wrote:
>>> Ping
>>>
>>> On Fri, Mar 2, 2018 at 1:23 PM, Jason Merrill <jason@redhat.com> wrote:
>>>> As I mentioned in the PR, the problem here is that we're replacing a
>>>> constructor with a dispatcher function which doesn't look much like a
>>>> constructor.  This patch adjusts make_dispatcher_decl to make it look
>>>> more like the functions it dispatches to, but other things are certain
>>>> to break for similar reasons down the road.  A proper solution should
>>>> be more transparent, like thunks.
>>>>
>>>> Tested x86_64-pc-linux-gnu.  Does this seem worth applying to fix the
>>>> regression?
>>
>> The patch looks reasonable to me, you probably know best whether
>> the cp/ parts are risky or not ;)
>>
>> So - OK from my POV.
>>
>> And yes, thunks may be a better representation for the dispatcher.
>
> It occurred to me that I could handle this more locally by deferring
> the function substitution until genericization time, so this is what
> I'm checking in:

...but now that we're in stage 1, it still seems sensible to have a
single way of checking whether something is a constructor.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit 656d038fe0cf78a2432a8c9a047edc93af6d5b23
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Mar 16 08:32:26 2018 -0400

            * cp-tree.h (DECL_CONSTRUCTOR_P): Use DECL_CXX_CONSTRUCTOR_P.
    
            (DECL_DESTRUCTOR_P): Use DECL_CXX_DESTRUCTOR_P.

diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 2df158c9ea6..a4e0099a249 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -2731,7 +2731,7 @@ struct GTY(()) lang_decl {
 /* For FUNCTION_DECLs and TEMPLATE_DECLs: nonzero means that this function
    is a constructor.  */
 #define DECL_CONSTRUCTOR_P(NODE) \
-  IDENTIFIER_CTOR_P (DECL_NAME (NODE))
+  DECL_CXX_CONSTRUCTOR_P (STRIP_TEMPLATE (NODE))
 
 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete
    object.  */
@@ -2760,7 +2760,7 @@ struct GTY(()) lang_decl {
 /* Nonzero if NODE (a FUNCTION_DECL or TEMPLATE_DECL)
    is a destructor.  */
 #define DECL_DESTRUCTOR_P(NODE)				\
-  IDENTIFIER_DTOR_P (DECL_NAME (NODE))
+  DECL_CXX_DESTRUCTOR_P (STRIP_TEMPLATE (NODE))
 
 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the
    specialized in-charge constructor, in-charge deleting constructor,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]