https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129121

            Bug ID: 129121
           Summary: exact same reflection code acting wierd in one place
                    and normal in the other
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: itfllow123 at gmail dot com
  Target Milestone: ---

Compiler version: experimental GCC 17.0.0 (straight from god-bolt)
link to full code:https://godbolt.org/z/hWjTTz17v
link to updated code (any workarounds may be published there):
https://github.com/HjaldrKhilji/-interpreter-engine/blob/main/Dynamic_memory_and_base_interpretor_foundation.cpp
The issue:
Code with the same exact sematics seems to work in one place and fail in the
other, the part where it fails, seems to fail in this case if you make it
"constexpr auto"(you cant std::meta:info is incomplete) or if you go out of
your way and make it auto (in which case the template for loop throws an
error). PLEASE FIX IT, I NEED THIS SINCE I WASTED TOO MUCH TIME WITHOUT
ANYTHING TO SHOW FOR IT.
code with issue:
        constexpr void call_func(std::size_t obj_index, std::size_t func_index)
{
            std::visit(
                [func_index](auto arg) {
                    if consteval{
                       
((*arg).[:look_up_namespace::get_meta_obj<decltype(*arg)>(func_index):])();
                    }
                    else{
                        static constexpr auto
index_data{look_up_namespace::get_initial_initializer<decltype(arg)>()};
                        std::size_t i=0;
                        template for(auto& x: index_data){
                            if(i==func_index){
                                (*arg.[:x:])();
                            }
                            i++;
                        }
                    }
                },
                dynamic_book_keeping.at(obj_index)
            );
        }

        constexpr void binary_op(std::size_t obj_index, std::size_t
obj_2_index, std::size_t func_index) {
            std::visit(
                [func_index](auto arg, auto arg_2) {
                    if consteval{
                       
((*arg).[:look_up_namespace::get_meta_obj<decltype(*arg)>(func_index):])();
                    }
                    else{
                        static constexpr auto
index_data{look_up_namespace::get_initial_initializer<decltype(arg)>()};
                        std::size_t i=0;
                        template for(auto& x: index_data){
                            if(i==func_index){
                                (*arg.[:x:])(*arg_2);
                            }
                            i++;
                        }
                    }
                },
                dynamic_book_keeping.at(obj_index),
                       dynamic_book_keeping.at(obj_2_index)
            );
        }
        constexpr void call_func(std::size_t obj_index, const std::string &
func_name) {
            std::visit(
                [&func_name](auto arg) {
                    static constexpr auto
index_data{look_up_namespace::get_initial_initializer<decltype(arg)>()};
                    template for(auto& x: index_data){
                        if(std::meta::identifier_of(x)==func_name){
                            (*arg.[:x:])();
                        }
                    }
                },
                dynamic_book_keeping.at(obj_index)
            );
        }


        constexpr void binary_op(std::size_t obj_index, std::size_t
obj_2_index, const std::string & func_name) {
            std::visit(
                [&func_name](auto arg, auto arg_2) {
                    static constexpr auto
index_data{look_up_namespace::get_initial_initializer<decltype(arg)>()};
                    template for(auto& x: index_data){
                        if(std::meta::identifier_of(x)==func_name){
                            (*arg.[:x:])(*arg_2);
                        }
                    }
                },
                dynamic_book_keeping.at(obj_index),
                dynamic_book_keeping.at(obj_2_index)
            );
        }

Reply via email to