Commit 7235a4d4 by Gabriel Dos Reis Committed by Gabriel Dos Reis

extern2.cc (foo): Declare as of type cost char*.

	* 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
parent 9bf820df
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> 2006-02-04 Thomas Koenig <Thomas.Koenig@online.de>
PR fortran/25075 PR fortran/25075
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
/* { dg-do compile } /* { dg-do compile }
{ dg-require-iconv "IBM1047" } { dg-require-iconv "IBM1047" }
{ dg-final { scan-assembler-not "foobar" } } */ { dg-final { scan-assembler-not "foobar" } } */
extern "C" { char *foo = "foobar"; } extern "C" { const char* foo = "foobar"; }
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
/* { dg-do compile } /* { dg-do compile }
{ dg-require-iconv "IBM1047" } { dg-require-iconv "IBM1047" }
{ dg-final { scan-assembler-not "string foobar" } } */ { dg-final { scan-assembler-not "string foobar" } } */
char *foo = "string foobar"; const char* foo = "string foobar";
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
// { dg-options "" } // { dg-options "" }
// { dg-final { scan-assembler "fancy_printf" } } // { 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"); } void foo() { printf("abc"); }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// { dg-options "" } // { dg-options "" }
// { dg-final { scan-assembler "fancy_printf" } } // { 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; } namespace std { using ::printf; }
......
// PR c++/9782 // PR c++/9782
extern "C" void printf(char *, ...); extern "C" void printf(const char*, ...);
template <int> template <int>
struct A { struct A {
......
...@@ -20,7 +20,7 @@ A::strcmp (const char *s, const char *t) ...@@ -20,7 +20,7 @@ A::strcmp (const char *s, const char *t)
} }
int int
foo (char *x) throw () foo (const char *x) throw ()
{ {
return A::strcmp ("", x); return A::strcmp ("", x);
} }
......
...@@ -20,7 +20,7 @@ A::strcmp (const char *s, const char *t) throw () ...@@ -20,7 +20,7 @@ A::strcmp (const char *s, const char *t) throw ()
} }
int int
foo (char *x) throw () foo (const char *x) throw ()
{ {
return A::strcmp ("", x); return A::strcmp ("", x);
} }
......
...@@ -16,7 +16,7 @@ A::strcmp (const char *s, const char *t) ...@@ -16,7 +16,7 @@ A::strcmp (const char *s, const char *t)
} }
int int
foo (char *x) foo (const char *x)
{ {
return A::strcmp ("", x); return A::strcmp ("", x);
} }
......
...@@ -10,7 +10,7 @@ struct C ...@@ -10,7 +10,7 @@ struct C
{ {
int foo (char ch, int offset = __INT_MAX__) const; int foo (char ch, int offset = __INT_MAX__) const;
int bar (int offset, char c) const; int bar (int offset, char c) const;
char *a; const char *a;
}; };
int C::bar (int offset, char c) const int C::bar (int offset, char c) const
......
int temp(char *temp); int temp(const char *temp);
template <int> int g() { return temp("Hi"); } template <int> int g() { return temp("Hi"); }
int g1() { return temp("Hi"); } int g1() { return temp("Hi"); }
...@@ -93,7 +93,7 @@ ulong memsize; ...@@ -93,7 +93,7 @@ ulong memsize;
ulong compression_quality; ulong compression_quality;
char *compressfile; char *compressfile;
int debug_level; int debug_level;
extern "C" int getopt (int, char**, char*); extern "C" int getopt (int, char**, const char*);
int int
main(int argc, char** argv) main(int argc, char** argv)
{ {
......
...@@ -12,7 +12,7 @@ public: ...@@ -12,7 +12,7 @@ public:
typedef int (PTcl::*InterpFuncP)(int,char**); typedef int (PTcl::*InterpFuncP)(int,char**);
struct InterpTableEntry { struct InterpTableEntry {
char* name; const char* name;
InterpFuncP func; InterpFuncP func;
}; };
......
...@@ -17,7 +17,7 @@ public: ...@@ -17,7 +17,7 @@ public:
typedef int (PTcl::*InterpFuncP)(int,char**); typedef int (PTcl::*InterpFuncP)(int,char**);
struct InterpTableEntry { struct InterpTableEntry {
char* name; const char* name;
InterpFuncP func; InterpFuncP func;
}; };
......
...@@ -15,7 +15,7 @@ class bar ...@@ -15,7 +15,7 @@ class bar
{ {
public: public:
bar(); 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 int
......
...@@ -8,7 +8,7 @@ extern "C" int printf (const char *, ...); ...@@ -8,7 +8,7 @@ extern "C" int printf (const char *, ...);
class Y class Y
{ {
public: public:
Y(char*) {} Y(const char*) {}
Y& operator = (const Y&) { return *this; } Y& operator = (const Y&) { return *this; }
}; };
...@@ -16,7 +16,7 @@ public: ...@@ -16,7 +16,7 @@ public:
class X class X
{ {
public: 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") {} X () : _v(0), _m("Unknown") {}
// Defining our own op= here makes things work correctly. // Defining our own op= here makes things work correctly.
......
// { dg-do run } // { dg-do run }
void f (char *const &) { } void f (const char *const &) { }
int main () int main ()
{ {
f ("hi"); f ("hi");
......
...@@ -21,14 +21,14 @@ struct A ...@@ -21,14 +21,14 @@ struct A
operator int () { return a; } operator int () { return a; }
}; };
extern "C" int atoi (char *); extern "C" int atoi (const char *);
int (*fee)(char *) = atoi; int (*fee)(const char *) = atoi;
int (**bar)(char *) = &fee; int (**bar)(const char *) = &fee;
char *s = "4"; const char* s = "4";
char **sp = &s; const char** sp = &s;
char ***spp = &sp; const char*** spp = &sp;
int foo (int a = (**bar) (s)) int foo (int a = (**bar) (s))
{ {
......
// { dg-do assemble } // { dg-do assemble }
wchar_t *single = L"xyz" ; const wchar_t *single = L"xyz" ;
wchar_t *(array[]) = { L"xyz" }; const wchar_t *(array[]) = { L"xyz" };
...@@ -48,5 +48,5 @@ Class1 :: Class1 (const String & constStringRef) ...@@ -48,5 +48,5 @@ Class1 :: Class1 (const String & constStringRef)
int main(void) int main(void)
{ {
Class1 *class1 = new Class1("Hi!"); Class1 *class1 = new Class1((char*) "Hi!");
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
class A { class A {
public: public:
typedef char * Ptr; typedef const char * Ptr;
Ptr s; Ptr s;
Ptr get_string(); Ptr get_string();
A(Ptr string); // { s = string; }; A(Ptr string); // { s = string; };
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
class X : public std::ifstream { // { dg-error "" } candidate class X : public std::ifstream { // { dg-error "" } candidate
public: public:
X(int a, char *b) {} // { dg-error "" } candidate X(int a, const char *b) {} // { dg-error "" } candidate
}; };
int main() int main()
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
class base_t { class base_t {
public: public:
virtual char *name () { return "base_t"; } virtual const char* name () { return "base_t"; }
base_t (); base_t ();
virtual ~base_t (); virtual ~base_t ();
...@@ -16,7 +16,7 @@ public: ...@@ -16,7 +16,7 @@ public:
class d1_t : public base_t { class d1_t : public base_t {
public: 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 // The const keyword on this constructor is an error, but it shouldn't
// cause the compiler to crash. // cause the compiler to crash.
...@@ -27,7 +27,7 @@ public: ...@@ -27,7 +27,7 @@ public:
class d2_t : public base_t { class d2_t : public base_t {
public: public:
virtual char *name () { return "d2_t"; } virtual const char* name () { return "d2_t"; }
d2_t (int); d2_t (int);
virtual ~d2_t (); virtual ~d2_t ();
......
...@@ -8,7 +8,7 @@ class bla { ...@@ -8,7 +8,7 @@ class bla {
public: public:
inline bla(char * jim) { ; }; inline bla(const char * jim) { ; };
inline ~bla() { destruct++; if (destruct == 2) printf ("PASS\n");}; inline ~bla() { destruct++; if (destruct == 2) printf ("PASS\n");};
}; };
......
...@@ -10,13 +10,13 @@ class BUG1 ...@@ -10,13 +10,13 @@ class BUG1
{ {
public: public:
operator char*() const { return myData; } operator const char*() const { return myData; }
char* myData; const char* myData;
}; };
void bug1() void bug1()
{ {
BUG1 bug1; BUG1 bug1;
bug1.myData = "0123456789"; bug1.myData = "0123456789";
char* s = bug1 + 1; const char* s = bug1 + 1;
} }
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
class C { class C {
private: private:
char** list; const char** list;
public: public:
C(char** ); C(const char** );
void count (int&); void count (int&);
}; };
C::C (char** l) { C::C (const char** l) {
list = l; list = l;
} }
...@@ -29,7 +29,7 @@ void C::count (int& total) { ...@@ -29,7 +29,7 @@ void C::count (int& total) {
} }
} }
char * foo[] = { const char * foo[] = {
"one", "two", "three", NULL}; "one", "two", "three", NULL};
int main() { int main() {
......
...@@ -10,7 +10,7 @@ typedef enum { BADBINOP = 0, PLUS, MINUS, MULT, DIV, POWR } binoptype; ...@@ -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 enum { BADUNOP = 0, NEG = POWR+1, SIN, COS, TAN } unoptype;
typedef struct { typedef struct {
char *s; const char *s;
union { union {
binoptype bop; binoptype bop;
unoptype uop; unoptype uop;
......
...@@ -7,20 +7,20 @@ ...@@ -7,20 +7,20 @@
class base { class base {
//========== //==========
void base_priv(char * n) void base_priv(const char * n)
{ std::cout << "base_priv called from: " << n << "\n"; }; { std::cout << "base_priv called from: " << n << "\n"; };
protected: protected:
void base_prot(char * n) void base_prot(const char * n)
{ std::cout << "base_prot called from: " << n << "\n"; }; { std::cout << "base_prot called from: " << n << "\n"; };
public: public:
void base_publ(char * n) void base_publ(const char * n)
{ std::cout << "base_publ called from: " << n << "\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 }; // class base
...@@ -33,7 +33,7 @@ friend void derived_friend(); ...@@ -33,7 +33,7 @@ friend void derived_friend();
public : public :
void test(char * n) { base_publ(n); base_prot(n);} void test(const char * n) { base_publ(n); base_prot(n);}
}; // class derived }; // class derived
......
...@@ -7,20 +7,20 @@ ...@@ -7,20 +7,20 @@
class base { class base {
//========== //==========
void base_priv(char * n) void base_priv(const char * n)
{ std::cout << "base_priv called from: " << n << "\n"; }; { std::cout << "base_priv called from: " << n << "\n"; };
protected: protected:
void base_prot(char * n) void base_prot(const char * n)
{ std::cout << "base_prot called from: " << n << "\n"; }; { std::cout << "base_prot called from: " << n << "\n"; };
public: public:
void base_publ(char * n) void base_publ(const char * n)
{ std::cout << "base_publ called from: " << n << "\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 }; // class base
...@@ -33,7 +33,7 @@ friend void derived_friend(); ...@@ -33,7 +33,7 @@ friend void derived_friend();
public : public :
void test(char * n) { base_publ(n); base_prot(n);} void test(const char * n) { base_publ(n); base_prot(n);}
}; // class derived }; // class derived
......
...@@ -14,7 +14,7 @@ public: ...@@ -14,7 +14,7 @@ public:
} a1; } a1;
class A2 { class A2 {
public: public:
operator char * () { operator const char * () {
return ""; return "";
} }
} a2; } a2;
...@@ -26,7 +26,7 @@ public: ...@@ -26,7 +26,7 @@ public:
} a3; } a3;
class A4 { class A4 {
public: public:
operator char * () { operator const char * () {
return ""; return "";
} }
operator unsigned long long int () { operator unsigned long long int () {
......
// { dg-do assemble } // { dg-do assemble }
char *a="aê"; const char *a="aê";
class A class A
{ {
public: public:
A() A()
{ {
char *b="aê"; const char *b="aê";
} }
}; };
char *c="aê"; const char *c="aê";
...@@ -90,7 +90,7 @@ foo_parm_returns_foo (foo f) ...@@ -90,7 +90,7 @@ foo_parm_returns_foo (foo f)
} }
void void
abort_because (char *str) abort_because (const char *str)
{ {
printf ("aborting because %s\n", str); printf ("aborting because %s\n", str);
abort (); abort ();
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
class call_trace { class call_trace {
public: public:
call_trace(char* fcn_name); call_trace(const char* fcn_name);
~call_trace(); ~call_trace();
}; };
...@@ -11,7 +11,7 @@ static char * last_tree; ...@@ -11,7 +11,7 @@ static char * last_tree;
extern "C" void prt(); extern "C" void prt();
char * smt_mark_stree() { char * smt_mark_stree() {
char* _my_name = "smt_mark_stree" ; const char* _my_name = "smt_mark_stree" ;
call_trace _t(_my_name); call_trace _t(_my_name);
return last_tree = 0 ? (char*)0 : (prt(), (char*)0); return last_tree = 0 ? (char*)0 : (prt(), (char*)0);
......
...@@ -2097,7 +2097,7 @@ Enumeration Func1(CapitalLetter CharPar1, CapitalLetter CharPar2); ...@@ -2097,7 +2097,7 @@ Enumeration Func1(CapitalLetter CharPar1, CapitalLetter CharPar2);
boolean Func2(String30 StrParI1, String30 StrParI2); boolean Func2(String30 StrParI1, String30 StrParI2);
boolean Func3(Enumeration EnumParIn); boolean Func3(Enumeration EnumParIn);
void mystrcpy(String30 s, char* t) void mystrcpy(String30 s, const char* t)
{ {
for (; *t != '\0'; ++s, ++t) *s = *t; for (; *t != '\0'; ++s, ++t) *s = *t;
*s = '\0'; *s = '\0';
......
...@@ -525,7 +525,7 @@ public: ...@@ -525,7 +525,7 @@ public:
char * char *
X::stringify() const // { dg-error "does not match" } X::stringify() const // { dg-error "does not match" }
{ {
return "stringify"; return "stringify"; // { dg-warning "deprecated" }
} }
const char * const char *
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// to fall over. // to fall over.
struct A { struct A {
char *name; const char *name;
int reserved; int reserved;
int a; int a;
int b; int b;
......
...@@ -62,10 +62,10 @@ class ShBop ...@@ -62,10 +62,10 @@ class ShBop
public: public:
inline ShBop(const ShBe* theBe); inline ShBop(const ShBe* theBe);
void shWw(bool, void shWw(bool,
char* a1 = "", const char* a1 = "",
char* a2 = "", const char* a2 = "",
int a3 = -1, int a3 = -1,
char* a4 = "foo"); const char* a4 = "foo");
typedef enum { shOk, typedef enum { shOk,
shFailed, shFailed,
shDone, shDone,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include <iostream> #include <iostream>
std::ostream& foo (char *x, std::ostream &y) std::ostream& foo (const char *x, std::ostream &y)
{ {
return y << "" << x; return y << "" << x;
} }
......
...@@ -8,6 +8,6 @@ void foo(double, U) {} ...@@ -8,6 +8,6 @@ void foo(double, U) {}
void baz() void baz()
{ {
foo<char*>(3.0, "abc"); foo<const char*>(3.0, "abc");
foo<char*, double>("abc", 3.0); foo<const char*, double>("abc", 3.0);
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
struct B { struct A { A(); int a; } aa; }; struct B { struct A { A(); int a; } aa; };
B::A::A () { a = 37; } B::A::A () { a = 37; }
char* xx[] = { const char* xx[] = {
"../tests/m6.cc:1: warning: return type specification for constructor invalid", "../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: semicolon missing after declaration of `A'",
"../tests/m6.cc:2: warning: empty declaration", "../tests/m6.cc:2: warning: empty declaration",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
struct B { struct A { A(); int a; }; A aa; }; struct B { struct A { A(); int a; }; A aa; };
B::A::A () { a = 37; } B::A::A () { a = 37; }
char *xx[]= {"/*", const char *xx[]= {"/*",
"../tests/m7.cc:1: warning: return type specification for constructor invalid", "../tests/m7.cc:1: warning: return type specification for constructor invalid",
"../tests/m7.cc: In function struct A A ():", "../tests/m7.cc: In function struct A A ():",
"../tests/m7.cc:2: `a' undeclared (first use this function)", "../tests/m7.cc:2: `a' undeclared (first use this function)",
......
...@@ -5,7 +5,7 @@ enum E { e }; ...@@ -5,7 +5,7 @@ enum E { e };
template <const E* ep> template <const E* ep>
struct S1 struct S1
{ {
static char* s; static const char* s;
}; };
template <int D> template <int D>
...@@ -25,4 +25,4 @@ struct S3 ...@@ -25,4 +25,4 @@ struct S3
E S2<1>::es[1] = {e}; E S2<1>::es[1] = {e};
template <> template <>
char* S1<S2<1>::es>::s = "abc"; const char* S1<S2<1>::es>::s = "abc";
...@@ -16,7 +16,7 @@ void frob<T>::print () { ...@@ -16,7 +16,7 @@ void frob<T>::print () {
} }
static int x[10]; static int x[10];
frob<char> fc ("hello"); frob<const char> fc ("hello");
frob<int> fi (x); frob<int> fi (x);
int main () { int main () {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// { dg-options "-O2 -fPIC " } // { dg-options "-O2 -fPIC " }
struct T struct T
{ {
char* f1; const char* f1;
int f2; int f2;
}; };
......
...@@ -5,7 +5,7 @@ extern "C" void exit (int); ...@@ -5,7 +5,7 @@ extern "C" void exit (int);
template <class T, int n, class U> struct A { template <class T, int n, class U> struct A {
A() {} A() {}
A(char*) {} A(const char*) {}
}; };
void f1() void f1()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment