gcc/cp/ChangeLog:
PR c++/41020
* decl.c (decls_match): Use DECL_IS_BUILTIN instead of
DECL_BUILT_IN.
gcc/testsuite/ChangeLog:
PR c++/41020
* g++.dg/lookup/extern-c-redecl2.C: New test.
* g++.dg/lookup/extern-c-redecl3.C: Likewise.
* g++.dg/lookup/extern-c-redecl4.C: Likewise.
* g++.dg/lookup/extern-c-redecl5.C: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153552
138bc75d-0d04-0410-961f-
82ee72b054a4
+2009-10-26 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/41020
+ * decl.c (decls_match): Use DECL_IS_BUILTIN instead of
+ DECL_BUILT_IN.
+
2009-10-23 Dodji Seketeli <dodji@redhat.com>
PR c++/40808
2009-10-23 Dodji Seketeli <dodji@redhat.com>
PR c++/40808
#ifdef NO_IMPLICIT_EXTERN_C
/* A new declaration doesn't match a built-in one unless it
is also extern "C". */
#ifdef NO_IMPLICIT_EXTERN_C
/* A new declaration doesn't match a built-in one unless it
is also extern "C". */
- if (DECL_BUILT_IN (olddecl)
+ if (DECL_IS_BUILTIN (olddecl)
&& DECL_EXTERN_C_P (olddecl) && !DECL_EXTERN_C_P (newdecl))
return 0;
#endif
&& DECL_EXTERN_C_P (olddecl) && !DECL_EXTERN_C_P (newdecl))
return 0;
#endif
+2009-10-26 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/41020
+ * g++.dg/lookup/extern-c-redecl2.C: New test.
+ * g++.dg/lookup/extern-c-redecl3.C: Likewise.
+ * g++.dg/lookup/extern-c-redecl4.C: Likewise.
+ * g++.dg/lookup/extern-c-redecl5.C: Likewise.
+
2009-10-26 Michael Matz <matz@suse.de>
PR tree-optimization/41783
2009-10-26 Michael Matz <matz@suse.de>
PR tree-optimization/41783
--- /dev/null
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin PR c++/41020
+// { dg-do compile }
+
+extern "C"
+{
+ int fork (void);
+}
+
+class frok
+{
+ int this_errno;
+ friend int fork (void);
+};
+
+extern "C" int
+fork (void)
+{
+ frok grouped;
+ return grouped.this_errno;
+}
--- /dev/null
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin: PR c++/41020
+// { dg-do compile }
+// { dg-final { scan-assembler-not "call\[\t \]+_Z4forkv" } }
+// { dg-final { scan-assembler "call\[\t \]+fork" } }
+
+extern "C" int fork (void);
+
+void
+foo ()
+{
+ extern int fork (void);
+ fork ();
+}
+
+extern "C"
+int
+fork (void)
+{
+ return 0;
+}
+
--- /dev/null
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin: PR c++/41020
+
+// Avoid the "-ansi -pedantic" option
+// { dg-options "" }
+// { dg-do compile }
+// { dg-final { scan-assembler "call\[\t \]+_Z4forkv" } }
+
+class frok
+{
+ int this_errno;
+ friend int fork (void);
+};
+
+void
+foo ()
+{
+ fork ();
+}
--- /dev/null
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin: PR c++/41020
+// { dg-do compile }
+
+
+class frok
+{
+ int this_errno;
+ friend int fork (void); // { dg-error "previous declaration .*?C++. linkage" }
+};
+
+extern "C" int
+fork (void) // { dg-error "conflicts with new declaration .*?C. linkage" }}
+{
+ frok grouped;
+ return grouped.this_errno;
+}
+