File tree Expand file tree Collapse file tree 4 files changed +72
-0
lines changed Expand file tree Collapse file tree 4 files changed +72
-0
lines changed Original file line number Diff line number Diff line change 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+ }
33+
Original file line number Diff line number Diff line change 1+ KNOWNBUG
2+ main.cpp
3+
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ ^VERIFICATION SUCCESSFUL$
7+ --
8+ ^warning: ignoring
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 1+ CORE winbug macos-assert-broken
2+ main.cpp
3+
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ ^VERIFICATION SUCCESSFUL$
7+ --
8+ ^warning: ignoring
You can’t perform that action at this time.
0 commit comments