You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Notice those lines have -std=c++14 first and -std=c++11 later, it builds successfully though.
This actually bit me when I added the example from #229 to the examples folder and tried to build it, build fails like this then:
g++ -DHAVE_CONFIG_H -I. -I../../examples -I.. -I../../src -I../../src/httpserver/ -DDEBUG -g -Wall -Wextra -Werror -pedantic -std=c++14 -Wno-unused-command-line-argument -O0 -DUSE_FASTOPEN -std=c++11 -DHTTPSERVER_COMPILATION -D_REENTRANT -MT bug_229.o -MD -MP -MF $depbase.Tpo -c -o bug_229.o ../../examples/bug_229.cpp &&\
mv -f $depbase.Tpo $depbase.Po
../../examples/bug_229.cpp: In member function ‘virtual const std::shared_ptr<httpserver::http_response> file_resource::render_POST(const httpserver::http_request&)’:
../../examples/bug_229.cpp:13:58: error: use of ‘auto’ in lambda parameter declaration only available with -std=c++14 or -std=gnu++14
std::for_each(headers.begin(), headers.end(), [](auto& p){
^~~~
../../examples/bug_229.cpp: In lambda function:
../../examples/bug_229.cpp:14:32: error: request for member ‘first’ in ‘p’, which is of non-class type ‘int’
std::cout << p.first << " -> " << p.second << std::endl;
^~~~~
../../examples/bug_229.cpp:14:53: error: request for member ‘second’ in ‘p’, which is of non-class type ‘int’
std::cout << p.first << " -> " << p.second << std::endl;
^~~~~~
../../examples/bug_229.cpp: In member function ‘virtual const std::shared_ptr<httpserver::http_response> file_resource::render_POST(const httpserver::http_request&)’:
../../examples/bug_229.cpp:19:52: error: use of ‘auto’ in lambda parameter declaration only available with -std=c++14 or -std=gnu++14
std::for_each(args.begin(), args.end(), [](auto& p) {
^~~~
../../examples/bug_229.cpp: In lambda function:
../../examples/bug_229.cpp:20:32: error: request for member ‘first’ in ‘p’, which is of non-class type ‘int’
std::cout << p.first << " -> " << p.second << std::endl;
^~~~~
../../examples/bug_229.cpp:20:53: error: request for member ‘second’ in ‘p’, which is of non-class type ‘int’
std::cout << p.first << " -> " << p.second << std::endl;
^~~~~~
…
Prerequisites
Description
Changeset 1e61eae added
-std=c++11toCXXFLAGSunconditionally, which is still in configure.ac, leading to this output:Notice those lines have
-std=c++14first and-std=c++11later, it builds successfully though.This actually bit me when I added the example from #229 to the examples folder and tried to build it, build fails like this then:
Steps to Reproduce
Expected behavior: Build does not fail.
Actual behavior: Build fails.
Reproduces how often: Always.
Versions
If you have problems during build:
Additional Information
C++14 support is required since #227 was merged.
config.log
I have no experience with autotools and can not provide a fix by myself.