Skip to content

Commit 602bfe9

Browse files
committed
Restores corrupted regression tests from cbmc-cpp
Signed-off-by: Felipe R. Monteiro <[email protected]>
1 parent 13116e2 commit 602bfe9

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

regression/cbmc-cpp/Lvalue1/main.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
struct A
2+
{
3+
int i;
4+
A() : i(0)
5+
{
6+
}
7+
int get_i()
8+
{
9+
return i;
10+
}
11+
};
12+
13+
A factory()
14+
{
15+
return A();
16+
}
17+
18+
int main()
19+
{
20+
// Altough the returned value of `factory' is an
21+
// rvalue, gcc accepts to bind it to the `this'
22+
// parameter of the method `get_i'. Note that when used,
23+
// a returned value is stored in a temporary
24+
// (see goto_convertt::remove_function_call). Thus,
25+
// the value returned by a function call can be treated
26+
// as an lvalue.
27+
//
28+
// It's not clear what the best is. Should this code be rejected?
29+
// Is the compatibility with gcc more important?
30+
31+
assert(factory().get_i() == 0);
32+
}

regression/cbmc-cpp/lvalue1/test.desc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
KNOWNBUG
2+
main.cpp
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring

regression/cbmc-cpp/typedef1/main.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <cassert>
2+
struct A
3+
{
4+
int i;
5+
A(int i) : i(i)
6+
{
7+
}
8+
};
9+
10+
class B : public A
11+
{
12+
public:
13+
typedef A _A;
14+
B() : _A(0)
15+
{
16+
}
17+
};
18+
19+
int main()
20+
{
21+
B b;
22+
assert(b.i == 0);
23+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE winbug macos-assert-broken
2+
main.cpp
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring

0 commit comments

Comments
 (0)