Skip to content
New issue

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

expected ';' after expression #37630

Closed
llvmbot opened this issue Jul 24, 2018 · 1 comment
Closed

expected ';' after expression #37630

llvmbot opened this issue Jul 24, 2018 · 1 comment
Labels
bugzilla Issues migrated from bugzilla c++

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 24, 2018

Bugzilla Link 38282
Resolution FIXED
Resolved on Jul 27, 2018 14:57
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @dwblaikie,@DougGregor

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?

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jul 27, 2018

Yes they are, as a fold-expression is a primary-expression.

Thanks! This is fixed in r338170.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++
Projects
None yet
Development

No branches or pull requests

1 participant