Closed snizovtsev closed 8 years ago
What's the exact GCC version you're on? I'm on the following and all tests pass:
g++-5 (Ubuntu 5.3.0-3ubuntu1~14.04) 5.3.0 20151204
I'm using Nix [1] package manager with gcc5 from nixpkgs-stable:
$ g++ --version
g++ (GCC) 5.3.0
Hmm. What are the flags you set for GCC? For my build, CXXFLAGS="-Wall -Wextra -pedantic"
and that's it.
Nothing:
# ...
patchPhase = ''
cp -a ${bencode}/include/bencode.hpp include
'';
configurePhase = ''
export INSTALL=install
export BOOST_INCLUDEDIR=${pkgs.boost.dev}/include
export BOOST_LIBRARYDIR=${pkgs.boost.lib}/lib
bfg9000 --prefix $prefix . build
'';
buildPhase = ''
ninja -C build -j $NIX_BUILD_CORES
'';
checkPhase = ''
ninja -C build -j $NIX_BUILD_CORES test
'';
installPhase = ''
ninja -C build install
'';
# ...
Weird. So the issue is that stringification of the type name via mettle::type_name<T>()
isn't working right. Could you try compiling and running the following? It's probably going to print something different from what I expect:
#include <iostream>
namespace mettle {
template<typename T>
std::basic_string<char> type_name() {
return std::string(__PRETTY_FUNCTION__);
}
}
int main() {
std::cout << mettle::type_name<int>() << std::endl;
return 0;
}
Here's what I get: std::basic_string<char> mettle::type_name() [with T = int]
Here is my output under Ubuntu 15.10 with installed Nix:
$ nix-shell -p gcc5 --pure
[nix-shell:~]$ c++ -std=c++14 test.cc
[nix-shell:~]$ ./a.out
std::__cxx11::basic_string<char> mettle::type_name() [with T = int]
Here is part of default.nix
file for nix-shell
that builds mettle as dependency of our project: https://gist.github.com/snizovtsev/3fbd3017cc4315b6fe4eabb3a66224f9
Ok, so it's actually an issue with libstdc++; they added an inline namespace at some point like libc++ has. I might end up having to use a regex instead of assuming I know what __PRETTY_FUNCTION__
looks like.
Could you try with the gcc-dual-abi branch I just pushed? It should resolve the issue.
It works: i've tested it under Nix/Clang 3.7.1 libc++/Darwin and Nix/GCC 5.3 stdc++/Ubuntu. Thank you!
This is in the master branch now. Thanks for the bug report!
Here is the output https://gist.github.com/snizovtsev/291238175c364a231026e0508fb3cc2c