toml11
toml11 copied to clipboard
Brace constructing a toml::value inserts a new array element in GCC 10.2.1
toml11v3.7.0
The toml2
variable in the below example is copy constructed incorrectly and has an empty array inserted on GCC but is correctly constructed on clang. The error looks to be to do with the toml::value
std::intializer_list
constructor std::enable_if
being too broad (toml/value.hpp:840).
#include <iostream>
#include <sstream>
#include "toml.hpp"
int main()
{
auto stream = std::istringstream{"a = 1"};
auto toml1 = toml::parse(stream);
auto toml2 = toml::value{toml1};
auto toml3 = toml::value(toml1);
std::cout << toml1 << toml2 << toml3;
return EXIT_SUCCESS;
}
$ g++ --version
g++ (GCC) 10.2.1 20200804 (Red Hat 10.2.1-2)
./mva_gcc
a = 1
[[]]
a = 1
a = 1
$ clang++ --version
clang version 10.0.1 (Red Hat 10.0.1-4.el7)
./mva_clang
a = 1
a = 1
a = 1
I am also having this issue