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

Fix operator parsing #2305

Merged
merged 1 commit into from
Jun 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions regression/cpp/Function_Overloading3/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
class t1
{
public:
t1(int n) : value(n)
{
}

int value;
int operator[](int n)
{
return n * value;
}
};

int operator+(t1 left, int right)
{
return left.value + right;
}

int main()
{
t1 t(10);
int t_1 = t + 5;
int t_2 = t[5];
__CPROVER_assert(t_1 == 15, "");
__CPROVER_assert(t_2 == 50, "");
return 0;
}
8 changes: 8 additions & 0 deletions regression/cpp/Function_Overloading3/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 regression/cpp/Unary_Function_Overload1/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
KNOWNBUG
CORE
main.cpp

^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cpp/Unary_Function_Overload2/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
KNOWNBUG
CORE
main.cpp

^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cpp/Unary_Function_Overload3/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
KNOWNBUG
CORE
main.cpp

^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3402,7 +3402,7 @@ bool Parser::rOperatorName(irept &name)
case '<':
case '>':
case ',':
operator_id=irep_idt(std::string(static_cast<char>(t), 1));
operator_id = std::string(1, static_cast<char>(t));
break;

case TOK_MULTASSIGN: operator_id="*="; break;
Expand Down