Hi,
I am getting the following build error with trunk:
../../gcc/gcc/tree.c: In member function ‘void
escaped_string::escape(const char*)’:
../../gcc/gcc/tree.c:12457:20: error: cast from type ‘const char*’ to
type ‘char*’ casts away qualifiers [-Werror=cast-qual]
   m_str = (char *) unescaped;
                    ^~~~~~~~~
I think this is caused by r261697 in tree.c:
  m_str = (char *) unescaped;

The patch changes it to const_cast<char *> (unescaped) which fixes the
build for me.
OK to commit ?

Thanks,
Prathamesh
diff --git a/gcc/tree.c b/gcc/tree.c
index 6728f1c..889d88c 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -12454,7 +12454,7 @@ escaped_string::escape (const char *unescaped)
   if (m_owned)
     free (m_str);
 
-  m_str = (char *) unescaped;
+  m_str = const_cast<char *> (unescaped);
   m_owned = false;
 
   if (unescaped == NULL || *unescaped == 0)

Reply via email to