Skip to content

MSVC Toml std::array not working #564

@HaydnTrigg

Description

@HaydnTrigg

I have the following code snippet, the json version works but the toml version breaks.

#include <rfl/json.hpp>
#include <rfl/toml.hpp>
#include <rfl.hpp>

struct MyStruct {
	std::array<char, 512> bytes;
};

int main()
{
	MyStruct mystruct;

	//const std::string json_string = rfl::json::write(mystruct); // works
	const std::string toml_string = rfl::toml::write(mystruct); // death

	return 0;
}
Build started at 3:05 AM...
1>------ Build started: Project: Test, Configuration: Debug x64 ------
1>  Test.cpp
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(223,44): error C2338: static assertion failed: 'A toml::value<> must model one of the native TOML value types:
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(223,44): error C2338: |   - std::string
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(223,44): error C2338: |   - int64_t
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(223,44): error C2338: |   - double
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(223,44): error C2338: |   - bool
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(223,44): error C2338: |   - toml::date
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(223,44): error C2338: |   - toml::time
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(223,44): error C2338: |   - toml::date_time'
1>  (compiling source file '../Test.cpp')
1>      A:\Test\tomlplusplus\include\toml++\impl\value.hpp(223,44):
1>      the template instantiation context (the oldest one first) is
1>          A:\Test\Test.cpp(14,45):
1>          see reference to function template instantiation 'std::string rfl::toml::write<,MyStruct>(const _T0 &)' being compiled
1>          with
1>          [
1>              _T0=MyStruct
1>          ]
1>          A:\Test\reflect-cpp\include\rfl\toml\write.hpp(44,30):
1>          see reference to function template instantiation 'void rfl::parsing::Parser<rfl::toml::Reader,rfl::toml::Writer,rfl::toml::write::T,rfl::toml::write::ProcessorsType>::write<rfl::parsing::Parent<rfl::toml::Writer>::Root>(const W &,const T &,const P &)' being compiled
1>          with
1>          [
1>              W=rfl::toml::Writer,
1>              T=rfl::toml::write::T,
1>              P=rfl::parsing::Parent<rfl::toml::Writer>::Root
1>          ]
1>          A:\Test\reflect-cpp\include\rfl\parsing\Parser_default.hpp(116,56):
1>          see reference to function template instantiation 'void rfl::parsing::NamedTupleParser<R,W,false,false,false,ProcessorsType,rfl::Field<rfl::internal::StringLiteral<6>{std::array<char,6>{_Ty98,121,116,101,115,0}},rfl::make_field::T0>>::write<P>(const W &,const rfl::NamedTuple<rfl::Field<rfl::internal::StringLiteral<6>{std::array<_Ty,6>{_Ty98,121,116,101,115,0}},rfl::make_field::T0>> &,const P &)' being compiled
1>          with
1>          [
1>              R=rfl::toml::Reader,
1>              W=rfl::toml::Writer,
1>              ProcessorsType=rfl::toml::write::ProcessorsType,
1>              _Ty=char,
1>              P=rfl::parsing::Parent<rfl::toml::Writer>::Root
1>          ]
1>          A:\Test\reflect-cpp\include\rfl\parsing\NamedTupleParser.hpp(156,7):
1>          see reference to function template instantiation 'void rfl::parsing::NamedTupleParser<R,W,false,false,false,ProcessorsType,rfl::Field<rfl::internal::StringLiteral<6>{std::array<char,6>{_Ty98,121,116,101,115,0}},rfl::make_field::T0>>::build_object<0>(const W &,const rfl::NamedTuple<rfl::Field<rfl::internal::StringLiteral<6>{std::array<_Ty,6>{_Ty98,121,116,101,115,0}},rfl::make_field::T0>> &,rfl::toml::Writer::TOMLObject *,std::integer_sequence<int,0>)' being compiled
1>          with
1>          [
1>              R=rfl::toml::Reader,
1>              W=rfl::toml::Writer,
1>              ProcessorsType=rfl::toml::write::ProcessorsType,
1>              _Ty=char
1>          ]
1>          A:\Test\reflect-cpp\include\rfl\parsing\NamedTupleParser.hpp(227,6):
1>          see reference to function template instantiation 'void rfl::parsing::NamedTupleParser<R,W,false,false,false,ProcessorsType,rfl::Field<rfl::internal::StringLiteral<6>{std::array<char,6>{_Ty98,121,116,101,115,0}},rfl::make_field::T0>>::add_field_to_object<0>(const W &,const rfl::NamedTuple<rfl::Field<rfl::internal::StringLiteral<6>{std::array<_Ty,6>{_Ty98,121,116,101,115,0}},rfl::make_field::T0>> &,rfl::toml::Writer::TOMLObject *)' being compiled
1>          with
1>          [
1>              R=rfl::toml::Reader,
1>              W=rfl::toml::Writer,
1>              ProcessorsType=rfl::toml::write::ProcessorsType,
1>              _Ty=char
1>          ]
1>          A:\Test\reflect-cpp\include\rfl\parsing\NamedTupleParser.hpp(202,50):
1>          see reference to function template instantiation 'void rfl::parsing::Parser<R,W,rfl::parsing::NamedTupleParser<R,W,false,false,false,ProcessorsType,rfl::Field<rfl::internal::StringLiteral<6>{std::array<char,6>{_Ty98,121,116,101,115,0}},rfl::make_field::T0>>::add_field_to_object::ValueType,ProcessorsType>::write<rfl::parsing::Parent<W>::Object>(const W &,T *,const P &)' being compiled
1>          with
1>          [
1>              R=rfl::toml::Reader,
1>              W=rfl::toml::Writer,
1>              ProcessorsType=rfl::toml::write::ProcessorsType,
1>              _Ty=char,
1>              T=const std::array<char,512>,
1>              P=rfl::parsing::Parent<rfl::toml::Writer>::Object
1>          ]
1>          A:\Test\reflect-cpp\include\rfl\parsing\Parser_ptr.hpp(55,59):
1>          see reference to function template instantiation 'void rfl::parsing::Parser<R,W,std::array<char,512>,ProcessorsType>::write<P>(const W &,const std::array<char,512> &,const P &)' being compiled
1>          with
1>          [
1>              R=rfl::toml::Reader,
1>              W=rfl::toml::Writer,
1>              ProcessorsType=rfl::toml::write::ProcessorsType,
1>              P=rfl::parsing::Parent<rfl::toml::Writer>::Object
1>          ]
1>          A:\Test\reflect-cpp\include\rfl\parsing\Parser_array.hpp(62,61):
1>          see reference to function template instantiation 'void rfl::parsing::Parser<R,W,char,ProcessorsType>::write<rfl::parsing::Parent<W>::Array>(const W &,const T &,const P &)' being compiled
1>          with
1>          [
1>              R=rfl::toml::Reader,
1>              W=rfl::toml::Writer,
1>              ProcessorsType=rfl::toml::write::ProcessorsType,
1>              T=char,
1>              P=rfl::parsing::Parent<rfl::toml::Writer>::Array
1>          ]
1>          A:\Test\reflect-cpp\include\rfl\parsing\Parser_basic_type.hpp(53,17):
1>          see reference to function template instantiation 'rfl::toml::Writer::TOMLVar rfl::parsing::Parent<rfl::toml::Writer>::add_value<P,T>(const W &,const T &,const ParentType &)' being compiled
1>          with
1>          [
1>              P=rfl::parsing::Parent<rfl::toml::Writer>::Array,
1>              T=char,
1>              W=rfl::toml::Writer,
1>              ParentType=rfl::parsing::Parent<rfl::toml::Writer>::Array
1>          ]
1>          A:\Test\reflect-cpp\include\rfl\parsing\Parent.hpp(190,17):
1>          see reference to function template instantiation 'rfl::toml::Writer::OutputVarType rfl::toml::Writer::add_value_to_array<T>(const T &,rfl::toml::Writer::OutputArrayType *) const' being compiled
1>          with
1>          [
1>              T=char
1>          ]
1>          A:\Test\reflect-cpp\include\rfl\toml\Writer.hpp(69,43):
1>          see reference to class template instantiation 'toml::v3::value<void>' being compiled
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(241,13): error C2182: 'val_': this use of 'void' is not valid
1>  (compiling source file '../Test.cpp')
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(255,21): error C7683: you cannot create a reference to 'void'
1>  (compiling source file '../Test.cpp')
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(644,15): error C7683: you cannot create a reference to 'void'
1>  (compiling source file '../Test.cpp')
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(651,16): error C7683: you cannot create a reference to 'void'
1>  (compiling source file '../Test.cpp')
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(658,21): error C7683: you cannot create a reference to 'void'
1>  (compiling source file '../Test.cpp')
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(665,22): error C7683: you cannot create a reference to 'void'
1>  (compiling source file '../Test.cpp')
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(672,15): error C7683: you cannot create a reference to 'void'
1>  (compiling source file '../Test.cpp')
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(679,16): error C7683: you cannot create a reference to 'void'
1>  (compiling source file '../Test.cpp')
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(686,21): error C7683: you cannot create a reference to 'void'
1>  (compiling source file '../Test.cpp')
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(693,22): error C7683: you cannot create a reference to 'void'
1>  (compiling source file '../Test.cpp')
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(700,31): error C7683: you cannot create a reference to 'void'
1>  (compiling source file '../Test.cpp')
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(707,31): error C7683: you cannot create a reference to 'void'
1>  (compiling source file '../Test.cpp')
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(714,37): error C7683: you cannot create a reference to 'void'
1>  (compiling source file '../Test.cpp')
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(721,37): error C7683: you cannot create a reference to 'void'
1>  (compiling source file '../Test.cpp')
1>A:\Test\tomlplusplus\include\toml++\impl\value.hpp(721,12): error C2535: 'toml::v3::value<void>::operator int &&(void) noexcept &&': member function already defined or declared
1>  (compiling source file '../Test.cpp')
1>      A:\Test\tomlplusplus\include\toml++\impl\value.hpp(707,12):
1>      see declaration of 'toml::v3::value<void>::operator int &&'
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========
========== Build completed at 3:05 AM and took 02.212 seconds ==========

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