Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22461

GCC 7 C++ 17 support for folding expressions

$
0
0

The following snippet will compile in GCC 8+, but fails to compile in GCC 7.

template <typename... THINGS>
struct A
{
  explicit A(THINGS *... things)
  {
    (..., [thing = things](){}());
  }
};


int main()
{
    int thing;
    const auto thingy = A{&thing};
}

godbolt

The stated failure is that the parameter pack isn't being expanded: parameter packs not expanded with '...'.
Checking the GCC standards compliance page, fold expressions should be supported in GCC 7.

Is there another flag i need besides std=c++17? (i didn't see one)
Is the standard not yet completely implemented? (i didn't see anything indicating that)
Can i make this work, or is this just a GCC 7 bug i'm going to have to work around?


Viewing all articles
Browse latest Browse all 22461

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>