Skip to content

RTTR_ENABLE fails ontemplate<size_t V> #382

@obfuscate

Description

@obfuscate

Hello there!

I've faced with a strange error during compilation this code:

class Test0
{
public:
	RTTR_ENABLE()
};

template<std::size_t _Order>
class Test1 : public Test0
{
public:
	RTTR_ENABLE(Test0)
};

And compiler says:

1>rttr\template_type_trait_impl.h(135,1): error C2672: 'rttr::type::get': no matching overloaded function found
1>(compiling source file 'test_cpp.cpp')
1>    \rttr\type.h(323,32):
1>    could be 'rttr::type rttr::type::get(T &&) noexcept'
1>        test_cpp.cpp(27,28):
1>        'rttr::type::get': invalid template argument for 'T', type expected
1>    rttr\type.h(310,32):
1>    or       'rttr::type rttr::type::get(void) noexcept'
1>        test_cpp.cpp(27,28):
1>        'rttr::type::get': invalid template argument for 'T', type expected
1>    rttr\detail\misc\template_type_trait_impl.h(135,1):
1>    the template instantiation context (the oldest one first) is
1>        asic_ecs_module.cpp(27,22):
1>        see reference to class template instantiation 'Test1<10000>' being compiled
1>        test_cpp.cpp(24,2):
1>        while compiling class template member function 'rttr::detail::derived_info Test1<10000>::get_derived_info(void)'
1>        test_cpp.cpp(24,2):
1>        see reference to function template instantiation 'rttr::type rttr::detail::get_type_from_instance<Test1<10000>>(const T *) noexcept' being compiled
1>        with
1>        [
1>            T=Test1<10000>
1>        ]
1>        rttr\detail\type\type_impl.h(325,20):
1>        see reference to function template instantiation 'rttr::type rttr::detail::create_or_get_type<Test1<10000>>(void) noexcept' being compiled
1>        rttr\detail\type\type_impl.h(304,77):
1>        see reference to function template instantiation 'std::unique_ptr<rttr::detail::type_data,std::default_delete<rttr::detail::type_data>> rttr::detail::make_type_data<Test1<10000>>(void)' being compiled
1>        rttr\detail\type\type_data.h(330,47):
1>        see reference to class template instantiation 'rttr::detail::template_type_trait<Test1<10000>>' being compiled
1>        rttr\detail\misc\template_type_trait_impl.h(135,1):
1>        while compiling class template member function 'std::vector<rttr::type,std::allocator<rttr::type>> rttr::detail::template_type_trait<Test1<10000>>::get_template_arguments(void)'
1>            rttr\detail\type\type_data.h(300,14):
1>            see the first reference to 'rttr::detail::template_type_trait<Test1<10000>>::get_template_arguments' in 'rttr::detail::make_type_data'
1>            rttr\detail\type\type_impl.h(304,77):
1>            see the first reference to 'rttr::detail::make_type_data' in 'rttr::detail::create_or_get_type'
1>            rttr\detail\type\type_impl.h(325,20):
1>            see the first reference to 'rttr::detail::create_or_get_type' in 'rttr::detail::get_type_from_instance'
1>            test_cpp.cpp(24,2):
1>            see the first reference to 'rttr::detail::get_type_from_instance' in 'Test1<10000>::get_derived_info'

but If I change the test1 like this:

template<typename T, T _Order>
class Test1 : public Test0
{
public:
	RTTR_ENABLE(Test0)
};

Everything compiles fine.

Do you have any idea what is wrong with the first code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions