http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49152

--- Comment #23 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-03-31 
00:34:58 UTC ---
BTW, I think this example was mentioned some where already, but I cannot find
it now. From http://clang.llvm.org/diagnostics.html

manuel@gcc12:~$ cat t.cc
struct a {
  virtual int bar();
};

struct foo : public virtual a {
};

int test(foo *P) {
  return P->bar() + *P;
}

manuel@gcc12:~$ trunk/180166/install/bin/g++ -fsyntax-only ~/t.cc
/home/manuel/t.cc: In function ‘void test(foo*)’:
/home/manuel/t.cc:9:22: error: no match for ‘operator+’ in ‘(((a*)P) +
((sizetype)(*(long int*)(P->foo::<anonymous>.a::_vptr.a +
0xffffffffffffffffffffffffffffffe0u))))->a::bar() + * P’

manuel@gcc12:~$ ~/bin/clang -fsyntax-only ~/t.cc 
/home/manuel/t.cc:9:19: error: invalid operands to binary expression ('int' and
'foo')
  return P->bar() + *P;
         ~~~~~~~~ ^ ~~
1 error generated.

Reply via email to