This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Q: Dangerous warning.
- To: egcs-bugs at cygnus dot com
- Subject: Q: Dangerous warning.
- From: Sergei Organov <osv at javad dot ru>
- Date: 23 Jan 1999 18:03:10 +0300
Hello;
I think this is egcs minor bug with compiler generated copy
constructors/assignment operators:
$ cat volwarn.cc
struct A { int i; };
extern A a;
extern A volatile va;
void foo() { a = va; }
$ c++ -c -Wall volwarn.cc
volwarn.cc: In function `void foo()':
volwarn.cc:4: warning: conversion from `volatile A' to `const A &' discards volatile
volwarn.cc:1: warning: in passing argument 1 of `A::operator =(const A &)'
$
As you see compiler generates (apparently wrong) assignment operator
and then warns me. So the questions are:
1. Is this egcs bug or C++ Standard requirement?
2. Can I safely ignore the warning (i.e. does egcs still consider
access to 'va' variable as volatile)?
Thank you in advance.
Regards,
Sergei Organov.