This is an archive of the discontinued LLVM Phabricator instance.

Fix usage of right shift operator in fold expressions
ClosedPublic

Authored by Rakete1111 on Jul 31 2017, 12:26 PM.

Details

Reviewers
rsmith
Summary

The right shift operator was not seen as a valid operator in a fold expression, which is PR32563.

Diff Detail

Event Timeline

Rakete1111 created this revision.Jul 31 2017, 12:26 PM

Updated test to use the -std=c++17 option + friendly ping

Rakete1111 added a project: Restricted Project.

Added the tests to the existing test file for fold operators that I didn't notice before :)

Used the correct return type, even if it doesn't really matter to the compiler.

Used the naming convention of LLVM + friendly ping. :)

rsmith accepted this revision.Oct 30 2017, 1:41 PM

Thanks!

lib/Parse/ParseExpr.cpp
273

Do we ever need to pass in the Parser's GreaterThanIsOperator value here? (From a quick check, it looks like we never call isFoldOperator in any case where > might end a template argument list instead, but it's not completely obvious, because we do support parsing unparenthesized fold operators for better error handling in some cases.)

Seems like it would be safer to pass the correct value in here, even if it happens to not matter right now.

This revision is now accepted and ready to land.Oct 30 2017, 1:41 PM

Used Parser's GreaterThanIsOperator just to be sure. :)

Added some more tests.
If this patch is still ok can you please commit it @rsmith ? Thanks!

rsmith closed this revision.Oct 31 2017, 1:30 PM

Committed as r317032, thanks!