https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102609
--- Comment #15 from waffl3x <waffl3x at protonmail dot com> --- Created attachment 55793 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55793&action=edit inital support for P0847 explicit-object-parameter Alright, I finalized something that I hope is worthy of criticism. I haven't ran tests on it yet but I think it should be relatively stable. My first time around I made the mistake of having hard failing TREE_CHECKs in if conditions, and I'm pretty sure that was causing problems with the tests (I saw a lot of segfaults), but I'm fairly sure it should be good this time (not that I shared the first one). I will probably start tests first thing tomorrow, hopefully I can figure out how to make it take less than 4-8 hours. I'm pretty happy with where I put most things, I didn't add anything to the core tree nodes, I instead used tree_decl_common::decl_flag_3 for PARM_DECL, but I added a member to lang_decl_base, hopefully this is satisfactory. As for what I know works right now, the below program outputs 15, 25, 35, 45 as you would expect. I haven't tried lambda's but I am sure they don't work. I have not tried anything with inheritance, I wouldn't bet on it working but I wouldn't bet against it. I have not tried implicit conversions, but I have a feeling they probably work. I was planning on implementing rejection of qualifiers on xobj member functions but I forgot, so that will come tomorrow. I also have to implement errors when trying to declare a xobj parameter in a function type. I haven't tried taking the address of an xobj member function, but I have a hunch it will work, they are almost entirely treated as static member functions at the moment. Speaking of that, the function declaration gets pretty printed as a static function at the moment too. So as you can see, there's still lots to do, but it shouldn't be as hard now that I am more familiar with the code base. Something I'm not especially happy with is how the error checking is strewn around. I tried to put it where it is most relevant, but prioritized putting it where I could get the best diagnostics, but I'm probably missing some things I could be doing to better group it together. I am also not happy with the quality of all of the diagnostics, I want to improve on that as I learn the quirks of the utilities. Please criticize, I am certain I am still doing some stuff wrong, so I would appreciate any input so I can correct those mistakes. Here is the aforementioned program that I know to work on my system. Surely nothing can go wrong, but who knows. #include <cstdio> struct S { int _a; int my_func(this S& s) { return s._a + 5; } int my_func(this S const& s) { return s._a + 15; } int my_func(this S&& s) { return s._a + 25; } int my_func(this S const&& s) { return s._a + 35; } template<typename Self> int my_func_dispatch(this Self&& self) { return static_cast<Self&&>(self).my_func(); } }; int main() { S s{10}; printf("%d\n", s.my_func_dispatch()); printf("%d\n", static_cast<S const&>(s).my_func_dispatch()); printf("%d\n", static_cast<S&&>(s).my_func_dispatch()); printf("%d\n", static_cast<S const&&>(s).my_func_dispatch()); }