Giter VIP home page Giter VIP logo

cpp17_headers's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cpp17_headers's Issues

libc++ missing symbols for bad_optional_access()

I don't know what, if anything, can be done about this but if you build on OS X with clang from Apple LLVM 7.3.0 (which comes with Xcode 7.3.1) and you use the experimental/optional header that comes with clang, then you'll get undefined symbol errors at link time if you use the optional::value() method (which needs to throw on bad references) ... here CppUtilTest.cpp is a test program I wrote to verify some local templates that use optional<>.

Undefined symbols for architecture x86_64:
  "std::experimental::bad_optional_access::~bad_optional_access()", referenced from:
/**
      CppUtilLookupTests_lookupStdFind_Test::TestBody() in CppUtilTest.cpp.o
      CppUtilLookupTests_lookupSpecialFind_Test::TestBody() in CppUtilTest.cpp.o
  "typeinfo for std::experimental::bad_optional_access", referenced from:
      CppUtilLookupTests_lookupStdFind_Test::TestBody() in CppUtilTest.cpp.o
      CppUtilLookupTests_lookupSpecialFind_Test::TestBody() in CppUtilTest.cpp.o
  "vtable for std::experimental::bad_optional_access", referenced from:
      CppUtilLookupTests_lookupStdFind_Test::TestBody() in CppUtilTest.cpp.o
      CppUtilLookupTests_lookupSpecialFind_Test::TestBody() in CppUtilTest.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64

I had to either go back to using the replacement optional.hpp from here, or else add this to my implementation (in the right namespace)

    bad_optional_access::~bad_optional_access() _NOEXCEPT = default;

Not sure what, if anything, can be done about this because I'm not sure if there's any reliable way to test for it being missing.

Missing using for std::nullopt in the namespace

For implementations which have <optional> or <experimental/optional>, you need to add:

using std::nullopt;

and

using std::experimental::nullopt;

to the STX_NAMESPACE_NAME otherwise those aren't available in the right namespace.

Increased testing coverage

It would be really great if we could expand the test coverage of the package to test more combinations of things: for example, if we can build/run tests with C++14 support, and with extensions enabled and disabled, and test both with (as now) and without forcing the internal versions to be used so we can verify the support for the native <experimental/*> headers when they're available.

The latter can be tested by just building the test files multiple times with different -D options to enable/disable the internal versions, but building with different levels of C++ support and enable/disable extensions might require multiple invocations of cmake since it doesn't seem you can just reset these values at build time... gross. Maybe adding some info to the README or including a script that will use out-of-source-tree builds to run cmake/compile multiple ways.

Also, it would be nice if we can enhance the test main() methods to show some info about which model we used to compile, e.g. whether the test used the native implementation vs. the stx implementation.

in_place_t / in_place_type / etc. failing to compile

I expect you're aware already but trying to compile test_all_includes.cpp with either clang 3.8 or g++ 5.4 or 6.2 gives errors about redefinitions of in_place* symbols:

[ 30%] Building CXX object test/CMakeFiles/test_all_includes.dir/test_all_includes.cpp.o
In file included from cpp17_headers/test/test_all_includes.cpp:12:0:
cpp17_headers/include/stx/variant.hpp:102:27: error: redefinition of 'struct stx::in_place_type_t<T>'
 template <class T> struct in_place_type_t {
                           ^~~~~~~~~~~~~~~
In file included from cpp17_headers/test/test_all_includes.cpp:6:0:
cpp17_headers/include/stx/optional.hpp:288:27: error: previous definition of 'struct stx::in_place_type_t<T>'
 template <class T> struct in_place_type_t {
                           ^~~~~~~~~~~~~~~
In file included from cpp17_headers/test/test_all_includes.cpp:12:0:
cpp17_headers/include/stx/variant.hpp:108:28: error: redefinition of 'struct stx::in_place_index_t<I>'
 template <size_t I> struct in_place_index_t {
                            ^~~~~~~~~~~~~~~~
In file included from cpp17_headers/test/test_all_includes.cpp:6:0:
cpp17_headers/include/stx/optional.hpp:293:28: error: previous definition of 'struct stx::in_place_index_t<I>'
 template <size_t I> struct in_place_index_t {
                            ^~~~~~~~~~~~~~~~

In clang we see:

[ 30%] Building CXX object test/CMakeFiles/test_all_includes.dir/test_all_includes.cpp.o
In file included from cpp17_headers/test/test_all_includes.cpp:12:
cpp17_headers/include/stx/variant.hpp:102:27: error:
      redefinition of 'in_place_type_t'
template <class T> struct in_place_type_t {
                          ^
cpp17_headers/include/stx/optional.hpp:288:27: note:
      previous definition is here
template <class T> struct in_place_type_t {
                          ^
In file included from cpp17_headers/test/test_all_includes.cpp:12:
cpp17_headers/include/stx/variant.hpp:106:30: error:
      redefinition of 'in_place_type'
constexpr in_place_type_t<T> in_place_type{};
                             ^
cpp17_headers/include/stx/optional.hpp:300:30: note:
      previous definition is here
constexpr in_place_type_t<T> in_place_type{};
                             ^
In file included from cpp17_headers/test/test_all_includes.cpp:12:
cpp17_headers/include/stx/variant.hpp:108:28: error:
      redefinition of 'in_place_index_t'
template <size_t I> struct in_place_index_t {
                           ^
cpp17_headers/include/stx/optional.hpp:293:28: note:
      previous definition is here
template <size_t I> struct in_place_index_t {
                           ^
In file included from cpp17_headers/test/test_all_includes.cpp:12:
cpp17_headers/include/stx/variant.hpp:112:31: error:
      redefinition of 'in_place_index'
constexpr in_place_index_t<I> in_place_index{};
                              ^
cpp17_headers/include/stx/optional.hpp:302:31: note:
      previous definition is here
constexpr in_place_index_t<I> in_place_index{};
                              ^

string_view and any do not work with libstdc++ in C++11 mode

libstdc++'s implementations of std::experimental::string_view and std::experimental::any (and optional) require C++14, and will static assert if the compiler is in C++11 mode.

This is not a problem for any, as libc++ doesn't have an implementation, so we can just test for __GNUC__ and __cplusplus < 201402 and be done with it.

It's also not a problem for optional, as neither libc++ or libstdc++'s versions work in C++11 mode so can use the same test.

It's trickier for string_view, because libc++'s implementation does work with C++11, so we'd prefer to use that if possible. We therefore need to check for the symbol __GLIBCXX__ instead (that is, checking for libstdc++ specifically, not just a GCC-compatible compiler), which requires including some standard library header. I'm not sure what a good candidate would be, because unfortunately the "empty" headers like <cstdbool> and <ciso464> don't appear to have this symbol defined.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.