We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
My command line is clang++ -std=c++17 code0.cpp
The code is as follow:
template<typename... Args> void spurious(Args... args) { (... + args).member; }
int main() { }
The error message is:
code0.cpp:4:14: error: expected ';' after expression (... + args).member; ^ ; code0.cpp:4:14: error: expected expression 2 errors generated.
Another similar code sample is as follow:
template <typename... Args> int foo (Args... args) { return (... + args).member; }
struct S { int member; } s = { 0 };
int main () { return foo (s); }
Again, clang++ rejects it, but g++ accept it.
Are the above two code samples legal code?
The text was updated successfully, but these errors were encountered:
Yes they are, as a fold-expression is a primary-expression.
Thanks! This is fixed in r338170.
Sorry, something went wrong.
No branches or pull requests
Extended Description
My command line is clang++ -std=c++17 code0.cpp
The code is as follow:
template<typename... Args>
void spurious(Args... args)
{
(... + args).member;
}
int main()
{
}
The error message is:
code0.cpp:4:14: error: expected ';' after expression
(... + args).member;
^
;
code0.cpp:4:14: error: expected expression
2 errors generated.
Another similar code sample is as follow:
template <typename... Args>
int
foo (Args... args)
{
return (... + args).member;
}
struct S { int member; } s = { 0 };
int
main ()
{
return foo (s);
}
Again, clang++ rejects it, but g++ accept it.
Are the above two code samples legal code?
The text was updated successfully, but these errors were encountered: