OSDN Git Service

PR c++/18530
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 24 Nov 2004 17:57:00 +0000 (17:57 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 24 Nov 2004 17:57:00 +0000 (17:57 +0000)
* cp-tree.h (CTOR_NAME): Remove.
(DTOR_NAME): Remove.
* decl.c (initialize_predefined_identifiers): Add spaces to the
end of constructor and destructor names.

PR c++/18530
* g++.dg/warn/Wshadow-3.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91179 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Wshadow-3.C [new file with mode: 0644]

index 8797df9..faf73ad 100644 (file)
@@ -1,3 +1,11 @@
+2004-11-24  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/18530
+       * cp-tree.h (CTOR_NAME): Remove.
+       (DTOR_NAME): Remove.
+       * decl.c (initialize_predefined_identifiers): Add spaces to the
+       end of constructor and destructor names.
+
 2004-11-24  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
 
        PR c++/8929
index 40979fb..64f5ab9 100644 (file)
@@ -3162,8 +3162,6 @@ extern GTY(()) varray_type local_classes;
 #endif /* NO_DOLLAR_IN_LABEL */
 
 #define THIS_NAME "this"
-#define CTOR_NAME "__ct"
-#define DTOR_NAME "__dt"
 
 #define IN_CHARGE_NAME "__in_chrg"
 
index bca3288..258ae43 100644 (file)
@@ -2923,13 +2923,15 @@ initialize_predefined_identifiers (void)
     { "C++", &lang_name_cplusplus, 0 },
     { "C", &lang_name_c, 0 },
     { "Java", &lang_name_java, 0 },
-    { CTOR_NAME, &ctor_identifier, 1 },
-    { "__base_ctor", &base_ctor_identifier, 1 },
-    { "__comp_ctor", &complete_ctor_identifier, 1 },
-    { DTOR_NAME, &dtor_identifier, 1 },
-    { "__comp_dtor", &complete_dtor_identifier, 1 },
-    { "__base_dtor", &base_dtor_identifier, 1 },
-    { "__deleting_dtor", &deleting_dtor_identifier, 1 },
+    /* Some of these names have a trailing space so that it is
+       impossible for them to conflict with names written by users.  */
+    { "__ct ", &ctor_identifier, 1 },
+    { "__base_ctor ", &base_ctor_identifier, 1 },
+    { "__comp_ctor ", &complete_ctor_identifier, 1 },
+    { "__dt ", &dtor_identifier, 1 },
+    { "__comp_dtor ", &complete_dtor_identifier, 1 },
+    { "__base_dtor ", &base_dtor_identifier, 1 },
+    { "__deleting_dtor ", &deleting_dtor_identifier, 1 },
     { IN_CHARGE_NAME, &in_charge_identifier, 0 },
     { "nelts", &nelts_identifier, 0 },
     { THIS_NAME, &this_identifier, 0 },
index cb68c28..03014a1 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-24  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/18530
+       * g++.dg/warn/Wshadow-3.C: New test.
+
 2004-11-24  Devang Patel  <dpatel@apple.com>
 
        PR/18555
diff --git a/gcc/testsuite/g++.dg/warn/Wshadow-3.C b/gcc/testsuite/g++.dg/warn/Wshadow-3.C
new file mode 100644 (file)
index 0000000..99add19
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/18530
+// { dg-options "-Wshadow" }
+
+struct A {
+  A();
+  ~A();
+  void foo (int __ct, int __dt) {}
+};