GCC causes segfault for lambda-captured parameter pack

前端 未结 1 1298
予麋鹿
予麋鹿 2020-12-31 04:10

I have the following SSCCE:

#include 
#include 

void foo(const std::string &a) {
  std::cout << a << std::endl         


        
1条回答
  •  伪装坚强ぢ
    2020-12-31 04:38

    I strongly suspect a g++ bug.


    Here are some notes:

    • replacing std::string with any elementary type, e.g., int still does not work
    • clang and VC++ will work just as intended
    • not passing parameter pack by reference causes an internal compiler error with g++ 7.0.1 with the following output:

    internal compiler error: in make_decl_rtl, at varasm.c:1304

    ...

    Please submit a full bug report, with preprocessed source if appropriate.

    Please include the complete backtrace with any bug report. See http://gcc.gnu.org/bugs.html for instructions.

    0 讨论(0)
提交回复
热议问题