This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/25992] conditional expression and strings literal



------- Comment #5 from bangerth at dealii dot org  2006-03-08 05:02 -------
Confirmed. These two lines should behave the same, but don't:
--------------
extern bool flag;
int main()
{
  char* p;
  p = (true ? "a" : "lalala" );
  p = (flag ? "a" : "lalala" ); 
}
--------------

g/x> /home/bangerth/bin/gcc-4.2*/bin/c++ -c x.cc -Wwrite-strings
x.cc: In function ‘int main()’:
x.cc:5: warning: deprecated conversion from string constant to
‘char*’'
x.cc:6: error: invalid conversion from ‘const char*’ to
‘char*’

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2006-03-08 05:02:36
               date|                            |


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]