[Bug c++/81042] Too many constexpr iterations on unreachable loop.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81042 Ralph Tandetzky changed: What|Removed |Added CC||ralph.tandetzky at gmail dot com --- Comment #4 from Ralph Tandetzky --- The following code: 1 constexpr int f() 2 { 3 for ( int i = 0; i < 1; ++i ) { 4 const int digit = i/1; 5 if( digit == 0 ) 6 continue; 7 for ( int j = 0; j < 0; ++j ) {} // <-- loop iteration count 8 // exceeds limit 9 } 10 return 0; 11 } 12 13 constexpr int i = f(); produces the following error with GCC 8.2: :13:20: in 'constexpr' expansion of 'f()' :7:9: error: 'constexpr' loop iteration count exceeds limit of 262144 (use -fconstexpr-loop-limit= to increase the limit) for ( int j = 0; j < 0; ++j ) {} ^~~
[Bug libstdc++/77322] New: [C++11] std::function::swap should be noexcept.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77322 Bug ID: 77322 Summary: [C++11] std::function::swap should be noexcept. Product: gcc Version: 6.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: ralph.tandetzky at gmail dot com Target Milestone: --- The C++11, C++14 and C++17 standard require, that std::function::swap() be noexcept. However, the following program does not compile: #include int main() { std::function<void()> f; static_assert( noexcept( f.swap(f) ), "" ); } This is the error message: main.cpp: In function 'int main()': main.cpp:6:5: error: static assertion failed static_assert( noexcept( f.swap(f) ), "" ); ^ By the way, clang does it right. This bug should be very simple to fix. This concerns all GCC versions that support C++11 from version 4.7 (or maybe earlier) until 6.1 (or maybe later).
[Bug c++/68071] Generic lambda variadic argument pack cannot be empty
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68071 Ralph Tandetzky changed: What|Removed |Added CC||ralph.tandetzky at gmail dot com --- Comment #2 from Ralph Tandetzky --- I can confirm that error. The code int main(){ [](auto...){}(); } leads to the following compile-time error: main.cpp: In function 'int main()': main.cpp:2:23: error: no match for call to '(main()::<lambda(auto:1, ...)>) ()' [](auto...){}(); ^ main.cpp:2:19: note: candidate: template main()::<lambda(auto:1, ...)> [](auto...){}(); ^ main.cpp:2:19: note: template argument deduction/substitution failed: main.cpp:2:23: note: candidate expects 1 argument, 0 provided [](auto...){}(); ^ This is the case for gcc 4.9 and gcc 5.2 with C++14 enabled. Clang 3.6 compiles it.
[Bug c++/68309] New: [C++14] Expanding a captured parameter pack with std::forward<decltype(args)>(args) fails.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68309 Bug ID: 68309 Summary: [C++14] Expanding a captured parameter pack with std::forward<decltype(args)>(args) fails. Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ralph.tandetzky at gmail dot com Target Milestone: --- Here's a minimal not-working example: #include using namespace std; template void print( Ts &&... args ) { [&] { const auto _ = { ((cout << forward<decltype(args)>(args) << endl),0)... }; (void)_; }(); } int main() { print( 1, "blub", std::to_string(3.1415), 4, 5.2 ); } This code fails with GCC 4.9. GCC 5.2 even crashes with a segfault. Clang 3.6 compiles it and gives the expected console output: 1 blub 3.141500 4 5.2 The curious thing is: When I remove the wrapping lambda, i.e. the line [&] { }(); then is compiles fine in all cases. Also when I replace decltype(args) with Ts, then it compiles fine and produces the correct console output. Go figure!
[Bug libstdc++/60564] New: [C++11] The std::packaged_task constructor taking a reference to a functor does not copy its argument.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60564 Bug ID: 60564 Summary: [C++11] The std::packaged_task constructor taking a reference to a functor does not copy its argument. Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: ralph.tandetzky at gmail dot com The following code compiles successfully: ~ #include future #include iostream using namespace std; struct Test { Test() { cout constructed. endl; } Test( const Test ) { cout copied. endl; } Test( Test ) { cout moved.endl; } void operator()() const {} }; int main() { Test t; packaged_taskvoid() pt1( t ); } ~ It produces the following output: ~ constructed. moved. ~ However, the constructor of std::packaged_taskvoid() should copy it's argument into its internally stored task object according to 30.6.9.1 of the C++11 standard (I'm referring to N3485, actually). Settings: I've used the online-compiler of http://en.cppreference.com/ with the compiler GCC 4.8 (C++11). GCC 4.7 (C++11) does not have the bug, but produces a correct output copying the object passed into the constructor.