]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
typeinfo (type_info::type_info(const char*)): Make `explicit'.
authorMark Mitchell <mark@markmitchell.com>
Fri, 4 Sep 1998 16:35:14 +0000 (16:35 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 4 Sep 1998 16:35:14 +0000 (16:35 +0000)
* inc/typeinfo (type_info::type_info(const char*)): Make
`explicit'.

From-SVN: r22235

gcc/cp/ChangeLog
gcc/cp/inc/typeinfo
gcc/testsuite/g++.old-deja/g++.other/typeinfo1.C [new file with mode: 0644]

index 1138e872fb7da7a67ee28dc10edb5223c7e5e4ec..0beacd2e8eda2bd933e0fc1a083e57c148f7072d 100644 (file)
@@ -1,5 +1,8 @@
 1998-09-04  Mark Mitchell  <mark@markmitchell.com>
 
+       * inc/typeinfo (type_info::type_info(const char*)): Make
+       `explicit'.
+
        * cp-tree.h (hash_tree_cons_simple): New macro.
        * pt.c (tsubst_arg_types): New function.  Use hash_tree_cons.
        (coerce_template_parms): Use make_temp_vec, instead of
index a735525b7b88aec9c28175ef9364f70fda42a15c..cf3b521af5ed7c9147121988217a9242b491f9ec 100644 (file)
@@ -17,7 +17,7 @@ private:
   type_info (const type_info&);
 
 protected:
-  type_info (const char *n): _name (n) { }
+  explicit type_info (const char *n): _name (n) { }
 
   const char *_name;
 
diff --git a/gcc/testsuite/g++.old-deja/g++.other/typeinfo1.C b/gcc/testsuite/g++.old-deja/g++.other/typeinfo1.C
new file mode 100644 (file)
index 0000000..070e885
--- /dev/null
@@ -0,0 +1,15 @@
+// Build don't link:
+
+#include <typeinfo>
+
+struct S {
+  S (const char*);
+};
+
+void f(S s);
+void f(type_info);
+
+void g()
+{
+  f("abc");
+}