Skip to content

Commit

Permalink
Merge pull request diffblue#8291 from tautschnig/bugfixes/c++-shift-v…
Browse files Browse the repository at this point in the history
…s-template

C++ front-end: fix parsing of >> as closing template args
  • Loading branch information
kroening authored Jun 9, 2024
2 parents 1657d97 + bc0ce46 commit 37511f3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
29 changes: 29 additions & 0 deletions regression/cpp/Templates4/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
template <typename _Tp>
struct __remove_cvref_t
{
};

template <typename _Tp, typename _Up = __remove_cvref_t<_Tp>>
struct __inv_unwrap
{
};

template <typename...>
struct __or_;

template <bool _Cond, typename _Iftrue, typename _Iffalse>
struct conditional
{
typedef _Iftrue type;
};

template <typename _B1, typename _B2, typename _B3, typename... _Bn>
struct __or_<_B1, _B2, _B3, _Bn...>
: public conditional<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>::type
{
};

int main(int argc, char *argv[])
{
int x = 10 >> 1;
}
8 changes: 8 additions & 0 deletions regression/cpp/Templates4/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.cpp

^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
^CONVERSION ERROR$
2 changes: 1 addition & 1 deletion src/cpp/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4057,8 +4057,8 @@ bool Parser::rTemplateArgs(irept &template_args)
tk2.text='>';
lex.Replace(tk2);
lex.Insert(tk2);
lex.get_token();
DATA_INVARIANT(lex.LookAhead(0) == '>', "should be >");
DATA_INVARIANT(lex.LookAhead(1) == '>', "should be >");
return true;

default:
Expand Down

0 comments on commit 37511f3

Please sign in to comment.