extern2.cc (foo): Declare as of type cost char*.
authorGabriel Dos Reis <gdr@integrable-solutions.net>
Sun, 5 Feb 2006 09:21:29 +0000 (09:21 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Sun, 5 Feb 2006 09:21:29 +0000 (09:21 +0000)
* g++.dg/charset/extern2.cc (foo): Declare as of type cost char*.
* g++.dg/charset/string.c (foo): Likewise.
* g++.dg/ext/builtin1.C (printf): Change first parameter type to
const char*
* g++.dg/ext/builtin2.C (printf): Likewise.
* g++.dg/init/new15.C (printf): Likewise.
* g++.dg/opt/pr17697-1.C (foo): Likewise.
* g++.dg/opt/pr17697-2.C (foo): Likewise.
* g++.dg/opt/pr17697-3.C (foo): Likewise.
* g++.dg/template/non-dependent4.C (temp): Likewise.
* g++.dg/opt/strength-reduce.C (C::a): Change type to const char*.
* g++.old-deja/g++.brendan/crash66.C (getopt): Change last
parameter type to const char*.
* g++.old-deja/g++.brendan/ptolemy1.C (InterpTableEntry::name):
Change type to const char*.
* g++.old-deja/g++.brendan/ptolemy2.C (InterpTableEntry::name):
Likewise.
* g++.old-deja/g++.jason/default2.C (bar::memberfunction): Change
second parameter type to const char*.
* g++.old-deja/g++.jason/opeq.C (X::X): Likewise.
(Y::Y): Change parameter type to const char*.
* g++.old-deja/g++.jason/ref12.C (f): Likewise.
* g++.old-deja/g++.jason/report.C: Apply const correctness.
* g++.old-deja/g++.jason/rfg6.C (single, array): Likewise.
* g++.old-deja/g++.jason/rvalue1.C (main): Cast string literal to
(char*).
* g++.old-deja/g++.jason/scoping4.C (A::Ptr): Make a typedef to
const char*.
* g++.old-deja/g++.law/ctors17.C (X::X): Change last parameter
type to const char*.
* g++.old-deja/g++.law/ctors7.C (base_t::name, d1_t, d2_t): Change
return type to const char*.
* g++.old-deja/g++.law/dtors2.C (bla::bla): Change parameter type
to const char*.
* g++.old-deja/g++.law/operators3.C: Adjust for const correctness.
* g++.old-deja/g++.law/refs1.C: Likewise.
* g++.old-deja/g++.law/visibility1.C: Likewise.
* g++.old-deja/g++.law/visibility2.C: Likewise.
* g++.old-deja/g++.law/union1.C (op_to_charp::s): Change type to
const char*.
* g++.old-deja/g++.mike/bool2.C: Adjust for const correctness..
* g++.old-deja/g++.mike/net48.C: Likewise.
* g++.old-deja/g++.mike/p646.C: Likewise.
* g++.old-deja/g++.mike/p6746.C: Likewise.
* g++.old-deja/g++.mike/p700.C (mystrcpy): Change last parameter
type to const char*.
* g++.old-deja/g++.mike/p811.C (X::stringify): Match for
deprecated conversion warning.
* g++.old-deja/g++.other/init15.C (A::name): Change type to const
char*.
* g++.old-deja/g++.other/inline12.C: Adjust for const correctness.
* g++.old-deja/g++.other/sibcall1.C (foo): Likewise.
* g++.old-deja/g++.pt/explicit8.C: Likewise.
* g++.old-deja/g++.pt/m6.C (xx): Likewise.
* g++.old-deja/g++.pt/m7.C (xx): Likewise.
* g++.old-deja/g++.pt/nontype3.C: Likewise.
* g++.old-deja/g++.pt/t39.C: Likewise.
* g++.old-deja/g++.robertl/eb106.C: Likewise.
* g++.old-deja/g++.robertl/ice990323-2.C: Likewise.

From-SVN: r110608

45 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/charset/extern2.cc
gcc/testsuite/g++.dg/charset/string.c
gcc/testsuite/g++.dg/ext/builtin1.C
gcc/testsuite/g++.dg/ext/builtin2.C
gcc/testsuite/g++.dg/init/new15.C
gcc/testsuite/g++.dg/opt/pr17697-1.C
gcc/testsuite/g++.dg/opt/pr17697-2.C
gcc/testsuite/g++.dg/opt/pr17697-3.C
gcc/testsuite/g++.dg/opt/strength-reduce.C
gcc/testsuite/g++.dg/template/non-dependent4.C
gcc/testsuite/g++.old-deja/g++.brendan/crash66.C
gcc/testsuite/g++.old-deja/g++.brendan/ptolemy1.C
gcc/testsuite/g++.old-deja/g++.brendan/ptolemy2.C
gcc/testsuite/g++.old-deja/g++.jason/default2.C
gcc/testsuite/g++.old-deja/g++.jason/opeq.C
gcc/testsuite/g++.old-deja/g++.jason/ref12.C
gcc/testsuite/g++.old-deja/g++.jason/report.C
gcc/testsuite/g++.old-deja/g++.jason/rfg6.C
gcc/testsuite/g++.old-deja/g++.jason/rvalue1.C
gcc/testsuite/g++.old-deja/g++.jason/scoping4.C
gcc/testsuite/g++.old-deja/g++.law/ctors17.C
gcc/testsuite/g++.old-deja/g++.law/ctors7.C
gcc/testsuite/g++.old-deja/g++.law/dtors2.C
gcc/testsuite/g++.old-deja/g++.law/operators3.C
gcc/testsuite/g++.old-deja/g++.law/refs1.C
gcc/testsuite/g++.old-deja/g++.law/union1.C
gcc/testsuite/g++.old-deja/g++.law/visibility1.C
gcc/testsuite/g++.old-deja/g++.law/visibility2.C
gcc/testsuite/g++.old-deja/g++.mike/bool2.C
gcc/testsuite/g++.old-deja/g++.mike/net48.C
gcc/testsuite/g++.old-deja/g++.mike/p646.C
gcc/testsuite/g++.old-deja/g++.mike/p6746.C
gcc/testsuite/g++.old-deja/g++.mike/p700.C
gcc/testsuite/g++.old-deja/g++.mike/p811.C
gcc/testsuite/g++.old-deja/g++.other/init15.C
gcc/testsuite/g++.old-deja/g++.other/inline12.C
gcc/testsuite/g++.old-deja/g++.other/sibcall1.C
gcc/testsuite/g++.old-deja/g++.pt/explicit8.C
gcc/testsuite/g++.old-deja/g++.pt/m6.C
gcc/testsuite/g++.old-deja/g++.pt/m7.C
gcc/testsuite/g++.old-deja/g++.pt/nontype3.C
gcc/testsuite/g++.old-deja/g++.pt/t39.C
gcc/testsuite/g++.old-deja/g++.robertl/eb106.C
gcc/testsuite/g++.old-deja/g++.robertl/ice990323-2.C

index d35cfa1ab105184b34188c76d48225a8542c3c81..2408c335e28f49d825daca78f1bfe9f36a26fcea 100644 (file)
@@ -1,3 +1,65 @@
+2006-02-05  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+
+       * g++.dg/charset/extern2.cc (foo): Declare as of type cost char*.
+       * g++.dg/charset/string.c (foo): Likewise.
+       * g++.dg/ext/builtin1.C (printf): Change first parameter type to
+       const char*
+       * g++.dg/ext/builtin2.C (printf): Likewise.
+       * g++.dg/init/new15.C (printf): Likewise.
+       * g++.dg/opt/pr17697-1.C (foo): Likewise.
+       * g++.dg/opt/pr17697-2.C (foo): Likewise.
+       * g++.dg/opt/pr17697-3.C (foo): Likewise.
+       * g++.dg/template/non-dependent4.C (temp): Likewise.
+       * g++.dg/opt/strength-reduce.C (C::a): Change type to const char*.
+       * g++.old-deja/g++.brendan/crash66.C (getopt): Change last
+       parameter type to const char*.
+       * g++.old-deja/g++.brendan/ptolemy1.C (InterpTableEntry::name):
+       Change type to const char*.
+       * g++.old-deja/g++.brendan/ptolemy2.C (InterpTableEntry::name):
+       Likewise. 
+       * g++.old-deja/g++.jason/default2.C (bar::memberfunction): Change
+       second parameter type to const char*.
+       * g++.old-deja/g++.jason/opeq.C (X::X): Likewise.
+       (Y::Y): Change parameter type to const char*.
+       * g++.old-deja/g++.jason/ref12.C (f): Likewise.
+       * g++.old-deja/g++.jason/report.C: Apply const correctness.
+       * g++.old-deja/g++.jason/rfg6.C (single, array): Likewise.
+       * g++.old-deja/g++.jason/rvalue1.C (main): Cast string literal to
+       (char*).
+       * g++.old-deja/g++.jason/scoping4.C (A::Ptr): Make a typedef to
+       const char*.
+       * g++.old-deja/g++.law/ctors17.C (X::X): Change last parameter
+       type to const char*.
+       * g++.old-deja/g++.law/ctors7.C (base_t::name, d1_t, d2_t): Change
+       return type to const char*.
+       * g++.old-deja/g++.law/dtors2.C (bla::bla): Change parameter type
+       to const char*.
+       * g++.old-deja/g++.law/operators3.C: Adjust for const correctness.
+       * g++.old-deja/g++.law/refs1.C: Likewise.
+       * g++.old-deja/g++.law/visibility1.C: Likewise.
+       * g++.old-deja/g++.law/visibility2.C: Likewise.
+       * g++.old-deja/g++.law/union1.C (op_to_charp::s): Change type to
+       const char*.
+       * g++.old-deja/g++.mike/bool2.C: Adjust for const correctness..
+       * g++.old-deja/g++.mike/net48.C: Likewise.
+       * g++.old-deja/g++.mike/p646.C: Likewise.
+       * g++.old-deja/g++.mike/p6746.C: Likewise.
+       * g++.old-deja/g++.mike/p700.C (mystrcpy): Change last parameter
+       type to const char*.
+       * g++.old-deja/g++.mike/p811.C (X::stringify): Match for
+       deprecated conversion warning.
+       * g++.old-deja/g++.other/init15.C (A::name): Change type to const
+       char*. 
+       * g++.old-deja/g++.other/inline12.C: Adjust for const correctness.
+       * g++.old-deja/g++.other/sibcall1.C (foo): Likewise.
+       * g++.old-deja/g++.pt/explicit8.C: Likewise.
+       * g++.old-deja/g++.pt/m6.C (xx): Likewise.
+       * g++.old-deja/g++.pt/m7.C (xx): Likewise.
+       * g++.old-deja/g++.pt/nontype3.C: Likewise.
+       * g++.old-deja/g++.pt/t39.C: Likewise.
+       * g++.old-deja/g++.robertl/eb106.C: Likewise.
+       * g++.old-deja/g++.robertl/ice990323-2.C: Likewise.
+
 2006-02-04  Thomas Koenig  <Thomas.Koenig@online.de>
 
        PR fortran/25075
index 3a8f4e82d7ef23f47d6fbc1754116ef886b887bb..9a0c85039560a9914c39704d78cbf9c13b493ea9 100644 (file)
@@ -2,4 +2,4 @@
 /* { dg-do compile }
    { dg-require-iconv "IBM1047" }
    { dg-final { scan-assembler-not "foobar" } } */
-extern "C" { char *foo = "foobar"; }
+extern "C" { const char* foo = "foobar"; }
index f720773dd57562e14708945da84ff8290855aae9..a09d39a2055c32e794df76dc9b1d28ffacdd6324 100644 (file)
@@ -2,4 +2,4 @@
 /* { dg-do compile }
    { dg-require-iconv "IBM1047" }
    { dg-final { scan-assembler-not "string foobar" } } */
-char *foo = "string foobar";
+const char* foo = "string foobar";
index 8a53fd6a31531bd6e24c5e0658dc0a7347fc8482..9947c85bf799b2ea5b51ebda5ff1c964db6dc62f 100644 (file)
@@ -5,6 +5,6 @@
 // { dg-options "" }
 // { dg-final { scan-assembler "fancy_printf" } }
 
-extern "C" int printf(char*, ...) __asm("_fancy_printf");
+extern "C" int printf(const char*, ...) __asm("_fancy_printf");
 
 void foo() { printf("abc"); }
index c741c0ba98f8e46f0b1fc6b1fea044dcc4ecf85b..ffa25285b59c5a5721555a64c01adbec0d4724bf 100644 (file)
@@ -6,7 +6,7 @@
 // { dg-options "" }
 // { dg-final { scan-assembler "fancy_printf" } }
 
-extern "C" int printf(char*, ...) __asm("_fancy_printf");
+extern "C" int printf(const char*, ...) __asm("_fancy_printf");
 
 namespace std { using ::printf; }
 
index 17cf8a80b6852037c3137ad1b33362e0df65abc1..b93b43c833f49f13323ebc3bb7a71988377423b5 100644 (file)
@@ -1,6 +1,6 @@
 // PR c++/9782
 
-extern "C" void printf(char *, ...);
+extern "C" void printf(const char*, ...);
 
 template <int>
 struct A {
index 0e2f671c629918da61e61f44d557723656ce8938..50a75b8453056413d845dbc2c12238a74a9f2d3c 100644 (file)
@@ -20,7 +20,7 @@ A::strcmp (const char *s, const char *t)
 }
 
 int
-foo (char *x) throw ()
+foo (const char *x) throw ()
 {
   return A::strcmp ("", x);
 }
index 11def66acd596987ec4b6dbc7c40861f57e86dd7..4a746be3d01e82e7df123887de0398592009d709 100644 (file)
@@ -20,7 +20,7 @@ A::strcmp (const char *s, const char *t) throw ()
 }
 
 int
-foo (char *x) throw ()
+foo (const char *x) throw ()
 {
   return A::strcmp ("", x);
 }
index b1369d1a427d1ad2b7b01a4930653e48b47b9f5c..fa7cff0a49fdf9a03649b2aca8e8ea78e9d462be 100644 (file)
@@ -16,7 +16,7 @@ A::strcmp (const char *s, const char *t)
 }
 
 int
-foo (char *x)
+foo (const char *x)
 {
   return A::strcmp ("", x);
 }
index 2dc6c01e853a5f3a852716e3dd96c8f11c1c6d1f..3fee937f1c15dafd96170218a60f3b16cc2ab9d4 100644 (file)
@@ -10,7 +10,7 @@ struct C
 {
   int foo (char ch, int offset = __INT_MAX__) const;
   int bar (int offset, char c) const;
-  char *a;
+   const char *a;
 };
 
 int C::bar (int offset, char c) const
index 637aabae4093213fa35595e9b560bce773b21a80..ff3a6eb2c90980a0435eadd6bade9dae61f1c4f6 100644 (file)
@@ -1,4 +1,4 @@
-int temp(char *temp);
+int temp(const char *temp);
 
 template <int> int g() { return temp("Hi"); }
 int g1() { return temp("Hi"); }
index 0f1d8919ebd2ce7ad73dc2e1317543e128691350..321c55130aab050e42ed3656cae2097563e9f154 100644 (file)
@@ -93,7 +93,7 @@ ulong memsize;
 ulong compression_quality;              
 char *compressfile;                     
 int debug_level;                        
-extern "C" int getopt (int, char**, char*);
+extern "C" int getopt (int, char**, const char*);
 int
 main(int argc, char** argv)
 {
index 4c7afeb2a439f250a188e9a0ee1633f71560d0ad..c5987fce03caee9ca6cae02808f468e9b7f75ef3 100644 (file)
@@ -12,7 +12,7 @@ public:
 typedef int (PTcl::*InterpFuncP)(int,char**);
 
 struct InterpTableEntry {
-       char* name;
+       const char* name;
        InterpFuncP func;
 };
 
index a8a0623210bc8d130a3f7cbf738b29ad19ef1b2e..669bd7914218abdb3d144a23e3004b9011e42364 100644 (file)
@@ -17,7 +17,7 @@ public:
 typedef int (PTcl::*InterpFuncP)(int,char**);
 
 struct InterpTableEntry {
-       char* name;
+       const char* name;
        InterpFuncP func;
 };
 
index 079ffab32a431fa67ad7ae7d15d5018acd15aa67..167ac635dbfac43091ac525d3edd8486f2c74ee9 100644 (file)
@@ -15,7 +15,7 @@ class bar
 {
  public:
   bar();
-  int memberfunction(int i, char *j, double k, foo foo1 = foo(0));
+  int memberfunction(int i, const char *j, double k, foo foo1 = foo(0));
 };
 
 int
index 741b977489b3c6ac98653a893445a49c63513f36..60fc5c1ae269503ecc77ad053f7fef44782e361b 100644 (file)
@@ -8,7 +8,7 @@ extern "C" int printf (const char *, ...);
 class Y 
 {
 public:
-    Y(char*) {}
+    Y(const char*) {}
     Y& operator = (const Y&) { return *this; }
 };
     
@@ -16,7 +16,7 @@ public:
 class X
 {
 public:
-    X(int v, char* m) : _v(v), _m (m) {}
+    X(int v, const char* m) : _v(v), _m (m) {}
     X () : _v(0), _m("Unknown") {}
     // Defining our own op= here makes things work correctly.
 
index 31b3f3c023ea26a4d28ea1e56955303f3344ae11..a604055fc5f613e789ccd53878d6066daee2d1c3 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-do run  }
-void f (char *const &) { }
+void f (const char *const &) { }
 int main ()
 {
   f ("hi");
index c1b9a57bbb0b529f68ca9176476e2e6d0d26d929..77fd7c32d8c47848c905d84b7b21ae78bf3c6ee4 100644 (file)
@@ -21,14 +21,14 @@ struct A
   operator int () { return a; }
 };
 
-extern "C" int atoi (char *);
+extern "C" int atoi (const char *);
 
-int (*fee)(char *) = atoi;
-int (**bar)(char *) = &fee;
+int (*fee)(const char *) = atoi;
+int (**bar)(const char *) = &fee;
 
-char *s = "4";
-char **sp = &s;
-char ***spp = &sp;
+const char* s = "4";
+const char** sp = &s;
+const char*** spp = &sp;
 
 int foo (int a = (**bar) (s))
 {
index fa422d302b4eb32807f9488d6c893c5f4bfba5f4..c2bca4554fa9465c4863edb18bd18da2ca3e3dc1 100644 (file)
@@ -1,4 +1,4 @@
 // { dg-do assemble  }
 
-wchar_t *single  =   L"xyz"  ;
-wchar_t *(array[]) = { L"xyz" };
+const wchar_t *single  =   L"xyz"  ;
+const wchar_t *(array[]) = { L"xyz" };
index c3afd36fb6392fac9186dd72aef118e752057d29..277d594b818fa40ccd8d389316ba99da76484bed 100644 (file)
@@ -48,5 +48,5 @@ Class1 :: Class1 (const String & constStringRef)
 
 int main(void)
 {
-  Class1 *class1 = new Class1("Hi!");
+  Class1 *class1 = new Class1((char*) "Hi!");
 }
index 54f5b67b7557a38ee7b852754aeea08d36b4e832..c32b4a66022fa519f844bf2c492ea2918a0045ea 100644 (file)
@@ -4,7 +4,7 @@
 
 class A {
 public:
-  typedef char * Ptr;
+  typedef const char * Ptr;
   Ptr s;
   Ptr get_string();
   A(Ptr string); // { s = string; };
index fb1d3f466865a43e57c9580d27f8b8dc7fa6c86c..1cee3082595932784d12b70a952365b31ec9972b 100644 (file)
@@ -11,7 +11,7 @@
 
 class X : public std::ifstream { // { dg-error "" } candidate
     public:
-      X(int a, char *b) {} // { dg-error "" } candidate
+      X(int a, const char *b) {} // { dg-error "" } candidate
 };
 int main()
 {
index 22f63db24c9a846029c5c629a1afb4de52d1a575..d2e0ef309995f425074a31e79a455770e1183255 100644 (file)
@@ -8,7 +8,7 @@
 
 class base_t {
 public:
-   virtual char *name () { return "base_t"; }
+   virtual const char* name () { return "base_t"; }
 
    base_t ();
    virtual ~base_t ();
@@ -16,7 +16,7 @@ public:
 
 class d1_t : public base_t {
 public:
-   virtual char *name () { return "d1_t"; }
+   virtual const char* name () { return "d1_t"; }
 
    //   The const keyword on this constructor is an error,  but  it shouldn't
    // cause the compiler to crash.
@@ -27,7 +27,7 @@ public:
 
 class d2_t : public base_t {
 public:
-   virtual char *name () { return "d2_t"; }
+   virtual const char* name () { return "d2_t"; }
 
    d2_t (int);
    virtual ~d2_t ();
index 7d8af475ba8862b0a3854b6adf3cda84a369dc66..a630f9db4aa3a04c7cf023f91c90bad135b5b3b5 100644 (file)
@@ -8,7 +8,7 @@ class bla {
 
 public:
 
-        inline bla(char * jim) { ; };
+        inline bla(const char * jim) { ; };
 
         inline ~bla() { destruct++; if (destruct == 2) printf ("PASS\n");};
 };
index d2e14d7477a770304aa4d83cf94de647153b9120..38c75b6634150cb77c4da294517d1dba8ffe9c77 100644 (file)
@@ -10,13 +10,13 @@ class BUG1
 {
   public:
 
-    operator char*() const { return myData; }
-    char* myData;
+    operator const char*() const { return myData; }
+    const char* myData;
 };
 
 void bug1()
 {
   BUG1 bug1;
   bug1.myData = "0123456789";
-  char* s = bug1 + 1;
+  const char* s = bug1 + 1;
 }
index 066c607045a86cbad7a9083666a262745c7b1dd3..d6dd21c272451b36130c68472fafaf9db0aaf5cf 100644 (file)
 
 class C {
 private:
-   char** list;
+   const char** list;
 public:
-   C(char** );
+   C(const char** );
    void count (int&);
 };
 
-C::C (char** l) {
+C::C (const char** l) {
    list = l;
 }
 
@@ -29,7 +29,7 @@ void C::count (int& total) {
    }
 }
 
-char * foo[] = {
+const char * foo[] = {
    "one", "two", "three", NULL};
 
 int main() {
index 5c97ae70e3b8875806d0ffdb7353ab3eae192152..9d700499daeffa42fdee9e87d3875bdb31a99970 100644 (file)
@@ -10,7 +10,7 @@ typedef enum { BADBINOP = 0, PLUS, MINUS, MULT, DIV, POWR } binoptype;
 typedef enum { BADUNOP = 0, NEG = POWR+1, SIN, COS, TAN } unoptype;
 
 typedef struct {
-  char *s;
+  const char *s;
   union {
     binoptype bop;
     unoptype uop;
index 66ce881c13fb5ddc469776d8bd4b083444c9f96a..02bfb2e5dfe375ea76da342c17d320c195c14ec0 100644 (file)
@@ -7,20 +7,20 @@
 class base {
 //==========
 
-    void base_priv(char * n)           
+    void base_priv(const char * n)             
        { std::cout << "base_priv called from: " << n << "\n";  };
 
 protected:
 
-    void base_prot(char * n) 
+    void base_prot(const char * n) 
        { std::cout << "base_prot called from: " << n << "\n"; };
 
 public:
 
-    void base_publ(char * n) 
+    void base_publ(const char * n) 
        { std::cout << "base_publ called from: " << n << "\n"; };
 
-    void test(char * n) { base_publ(n); base_prot(n); base_priv(n); }
+    void test(const char * n) { base_publ(n); base_prot(n); base_priv(n); }
 
 }; // class base
  
@@ -33,7 +33,7 @@ friend void derived_friend();
 
 public :
 
-    void test(char * n) { base_publ(n); base_prot(n);}
+    void test(const char * n) { base_publ(n); base_prot(n);}
 
 }; // class derived
 
index 781846f3b991b9d95510902384df745ae96a532b..42d267368ce5dc324a977b547f0c51405f34dac1 100644 (file)
@@ -7,20 +7,20 @@
 class base {
 //==========
 
-    void base_priv(char * n)           
+    void base_priv(const char * n)             
        { std::cout << "base_priv called from: " << n << "\n";  };
 
 protected:
 
-    void base_prot(char * n) 
+    void base_prot(const char * n) 
        { std::cout << "base_prot called from: " << n << "\n"; };
 
 public:
 
-    void base_publ(char * n) 
+    void base_publ(const char * n) 
        { std::cout << "base_publ called from: " << n << "\n"; };
 
-    void test(char * n) { base_publ(n); base_prot(n); base_priv(n); }
+    void test(const char * n) { base_publ(n); base_prot(n); base_priv(n); }
 
 }; // class base
  
@@ -33,7 +33,7 @@ friend void derived_friend();
 
 public :
 
-    void test(char * n) { base_publ(n); base_prot(n);}
+    void test(const char * n) { base_publ(n); base_prot(n);}
 
 }; // class derived
 
index 4bf13a2c4c0a151736a4ae65b71b945ec00fa9a5..3d8bc3c03ebd382c9fa58cdec56613d28fbdf585 100644 (file)
@@ -14,7 +14,7 @@ public:
 } a1;
 class A2 {
 public:
-  operator char * () {
+  operator const char * () {
     return "";
   }
 } a2;
@@ -26,7 +26,7 @@ public:
 } a3;
 class A4 {
 public:
-  operator char * () {
+  operator const char * () {
     return "";
   }
   operator unsigned long long int () {
index bc0220ab7e95044c2f111a02cc7095fdecede5e9..2553fab1dfc915f46b618223703724227cf5ecde 100644 (file)
@@ -1,14 +1,14 @@
 // { dg-do assemble  }
 
-char *a="aê";
+const char *a="aê";
 
 class A
 {
 public:
        A()
        {
-               char *b="aê";
+               const char *b="aê";
        }
 };
 
-char *c="aê";
+const char *c="aê";
index 3fdcd41aece4d018e25f105dd4f3e634ec95610b..4f7807d11604acbb6b49257efb63274f996b8d86 100644 (file)
@@ -90,7 +90,7 @@ foo_parm_returns_foo (foo f)
 }
 
 void
-abort_because (char *str)
+abort_because (const char *str)
 {
   printf ("aborting because %s\n", str);
   abort ();
index 11829f89f7d1e0d5074d667f0ad89ad7a7ef859a..09809a8017c27f78f9318cf69f0eb38d9957bdca 100644 (file)
@@ -3,7 +3,7 @@
 
 class call_trace {
 public:
-  call_trace(char* fcn_name);
+  call_trace(const char* fcn_name);
   ~call_trace();
 };
 
@@ -11,7 +11,7 @@ static char * last_tree;
 extern "C" void prt();
 
 char * smt_mark_stree() {
-  char* _my_name = "smt_mark_stree" ; 
+  const char* _my_name = "smt_mark_stree" ; 
   call_trace _t(_my_name);
 
   return last_tree = 0 ? (char*)0 : (prt(), (char*)0);
index 106a497d0409fd38f9bd27883e432f779d61d523..5541bec08d1c143c4ceb87a84df5846bf30d394c 100644 (file)
@@ -2097,7 +2097,7 @@ Enumeration Func1(CapitalLetter   CharPar1, CapitalLetter CharPar2);
 boolean Func2(String30 StrParI1, String30      StrParI2);
 boolean Func3(Enumeration      EnumParIn);
 
-void mystrcpy(String30 s, char* t)
+void mystrcpy(String30 s, const char* t)
 {
   for (; *t != '\0'; ++s, ++t) *s = *t;
   *s = '\0';
index 260c6459cb870794444caf2380d566ebe62eab6c..7097eeec03e640969df0b5e151c71195df091c8b 100644 (file)
@@ -525,7 +525,7 @@ public:
 char *
 X::stringify() const  // { dg-error "does not match" }
 {
-    return "stringify";
+    return "stringify";         // { dg-warning "deprecated" }
 }
 
 const char *
index a84bfa1d377909ca5442b2ee2698c885b4381095..022f2ef98079f03c03b9191de7291e1d2791e2d4 100644 (file)
@@ -7,7 +7,7 @@
 // to fall over.
 
 struct A {
-  char *name;
+  const char *name;
   int reserved;
   int a;
   int b;
index 064827dedf638f74c0b2acb62173a0659a8f0501..c91845c411ee3cad0fa6bc2abed76812048e94ee 100644 (file)
@@ -62,10 +62,10 @@ class ShBop
  public:
   inline ShBop(const ShBe* theBe);
   void            shWw(bool,
-                                char* a1 = "",
-                                char* a2 = "",
+                                const char* a1 = "",
+                                const char* a2 = "",
                                 int   a3 = -1,
-                                char* a4 = "foo");
+                                const char* a4 = "foo");
   typedef enum { shOk,
                  shFailed,
                  shDone,
index 7b5a82b78e74426f3038659207d1cb71c2cf2160..fa9e37b378c7ed8e2e78e1df4d5373064fc22d36 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <iostream>
 
-std::ostream& foo (char *x, std::ostream &y)
+std::ostream& foo (const char *x, std::ostream &y)
 {
   return y << "" << x;
 }
index 6fdb01d24d817da397db4bebcc0d9eac015fa970..3a75aa0dbb56c72d843801765cf9c2b8eb208e41 100644 (file)
@@ -8,6 +8,6 @@ void foo(double, U) {}
 
 void baz()
 {
-  foo<char*>(3.0, "abc");
-  foo<char*, double>("abc", 3.0);
+  foo<const char*>(3.0, "abc");
+  foo<const char*, double>("abc", 3.0);
 }
index 8de211c1220d1ce479c5609b945231f08ebf2955..24c65b22a4e1566a48c507987461fa9d561a1089 100644 (file)
@@ -2,7 +2,7 @@
 
 struct B { struct A { A(); int a; } aa; };
 B::A::A () { a = 37; }
-char* xx[] = {
+const char* xx[] = {
 "../tests/m6.cc:1: warning: return type specification for constructor invalid",
 "../tests/m6.cc:2: semicolon missing after declaration of `A'",
 "../tests/m6.cc:2: warning: empty declaration",
index 1615a4916de3d06c19031a4465cde19e3f38c64e..4c7fdd5e947d4057b166632566f78380b445e5b6 100644 (file)
@@ -2,7 +2,7 @@
 
 struct B { struct A { A(); int a; }; A aa; };
 B::A::A () { a = 37; }
-char *xx[]= {"/*",
+const char *xx[]= {"/*",
 "../tests/m7.cc:1: warning: return type specification for constructor invalid",
 "../tests/m7.cc: In function struct A A ():",
 "../tests/m7.cc:2: `a' undeclared (first use this function)",
index 88904a84e56a226618e2ecc13cf8678871fd9fda..f48d00010f46c29f583a4e0073e4f035cd473802 100644 (file)
@@ -5,7 +5,7 @@ enum E { e };
 template <const E* ep>
 struct S1
 {
-  static char* s;
+  static const char* s;
 };
 
 template <int D>
@@ -25,4 +25,4 @@ struct S3
 E S2<1>::es[1] = {e};
 
 template <>
-char* S1<S2<1>::es>::s = "abc";
+const char* S1<S2<1>::es>::s = "abc";
index 82b584c2fb11324fdc0fc279b00694d535fa1b09..8f9bead3a715082bbb44c92123b295759f875616 100644 (file)
@@ -16,7 +16,7 @@ void frob<T>::print () {
 }
 
   static int x[10];
-  frob<char> fc ("hello");
+  frob<const char> fc ("hello");
   frob<int> fi (x);
 
 int main () {
index 9fa686e1313437ab457156e55864cb23a0e71485..b341cff5502301a61730b81504ede0a04e7b914a 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-options "-O2 -fPIC " }
 struct T
 {
-       char*   f1;
+       const char*     f1;
        int     f2;
 };
 
index 6ba0f05485a625a261b4bf0a98b0ad7334f8d5d0..cefef775062aedb2648179bfd294cf026a47ee33 100644 (file)
@@ -5,7 +5,7 @@ extern "C" void exit (int);
 
 template <class T, int n, class U> struct A {
        A() {}
-       A(char*) {}
+       A(const char*) {}
 };
 
 void f1()