Activity log for bug #1392888

Date Who What changed Old value New value Message
2014-11-14 22:33:19 Alan Chen bug added bug
2014-11-14 22:34:07 Alan Chen description Sample program below compiles with gcc with no errors, but results with a compile error with g++ g++ version: 4.8.2-19ubuntu1 gcc -O2 prog.c # ok g++ -O2 prog.c # error In file included from /usr/include/fcntl.h:279:0, from prog.c:6: In function ‘int open(const char*, int, ...)’, inlined from ‘int main()’ at prog.c:12:40: /usr/include/x86_64-linux-gnu/bits/fcntl2.h:44:28: error: call to ‘__open_too_many_args’ declared with attribute error: open can be called either with 2 or 3 arguments, not more __open_too_many_args (); Sample program: #pragma GCC optimize ("O0") #include <fcntl.h> #include <unistd.h> int main() { int fd; fd = open( "filename", O_RDONLY, 0644); if (fd < 0) return 1; close(fd); return 0; } Sample program below compiles with gcc with no errors, but results with a compile error with g++ g++ version: 4.8.2-19ubuntu1 gcc -O2 prog.c # ok g++ -O2 prog.c # error In file included from /usr/include/fcntl.h:279:0,                  from prog.c:5: In function ‘int open(const char*, int, ...)’,     inlined from ‘int main()’ at prog.c:12:40: /usr/include/x86_64-linux-gnu/bits/fcntl2.h:44:28: error: call to ‘__open_too_many_args’ declared with attribute error: open can be called either with 2 or 3 arguments, not more      __open_too_many_args (); Sample program: #pragma GCC optimize ("O0") #include <fcntl.h> #include <unistd.h> int main() {  int fd;  fd = open( "filename", O_RDONLY, 0644);  if (fd < 0) return 1;  close(fd);  return 0; }