Giter Club home page Giter Club logo

constexpr_all_the_things's Introduction

lefticus - Jason Turner

I am regular conference speaker, trainer, and C++ contractor.

I am available for code reviews and on-site training.

constexpr_all_the_things's People

Contributors

elbeno avatar lefticus avatar

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

constexpr_all_the_things's Issues

Build error when using a recent gcc (all the things are not constexpr!)

GCC 7 and earlier have a bug (Bug 70167) that it treats T{} in the same way as C99 compound literals. This was recently fixed, with the result that the trunk gcc now correctly gives errors for the construct constexpr std::initializer_list<T> il{Ts...}; in cx_json_parser.h as il is not initialized by a constant expression (the standard specifies this initialization as involving pointers to a temporary object on the stack...).

Use gcc-trunk (20171123) and fail to compile: variable set but not used

Hi, I watched the talk on CppCon2017 and tried to compile the piece of code with gcc-trunk but the compiler would say something like:

variable ‘b’ set but not used [-Werror=unused-but-set-variable]

My compiler version is

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/phi/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./../gcc-trunk/configure --prefix=/home/phi/gcc-trunk --enable-languages=c,c++ : (reconfigured) /media/phi/a60c856b-88ad-4199-ab95-a49fc0c9466a/codebase/gcc-infrastructure/objdir/../gcc-trunk/configure --prefix=/home/phi/gcc-trunk --enable-languages=c,c++
Thread model: posix
gcc version 8.0.0 20171123 (experimental) (GCC)

I use the command
cd build && cmake -D CMAKE_CXX_COMPILER=/home/phi/gcc-trunk/bin/g++ CMAKE_C_COMPILER=/home/phi/gcc-trunk/bin/gcc ../ to generate the Makefile.

The error message is like:

<dir>/src/test/algorithm.cpp: In function ‘void algo_tests_nonmod()’:
<dir>/src/test/algorithm.cpp:11:20: error: variable ‘b’ set but not used [-Werror=unused-but-set-variable]
     constexpr bool b = cx::all_of(std::cbegin(arr), std::cend(arr),
                    ^
<dir>/src/test/algorithm.cpp:18:20: error: variable ‘b’ set but not used [-Werror=unused-but-set-variable]
     constexpr bool b = cx::any_of(std::cbegin(arr), std::cend(arr),
                    ^
... (other variable unused error messages) ...

But when I checked the code these variables is used by static_assert like static_assert(b, "all_of fail");.

It seems so weird to me since these variables are used in the next line. Could anyone give me some insight or helps for how to go through this issue? (An obvious solution is turning off the -Werror option.)

Thanks.

License

Hi Jason & Ben!

First I want to start of by saing "Great talk!" (as usual).
I'm prepping a talk for myself on a compile-time lisp interpreter, is it ok to use this project as a basis for my talk?

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.