This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ Patch] PR 30500
- From: Paolo Carlini <pcarlini at suse dot de>
- To: "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>
- Cc: Mark Mitchell <mark at codesourcery dot com>
- Date: Mon, 26 Mar 2007 04:05:34 +0200
- Subject: [C++ Patch] PR 30500
Hi,
I have the below one-liner fixing this long-standing annoying issue,
seems to me rather straigtforward and consistent with
instantiate_class_template. Tested x86-linux (also checked that the
snippets in 30463 / 30464 do not warn anymore)
Ok for mainline?
Paolo.
//////////////
2007-03-25 Paolo Carlini <pcarlini@suse.de>
PR c++/30500
* pt.c (instantiate_decl): Set in_system_header.
2007-03-25 Paolo Carlini <pcarlini@suse.de>
PR c++/30500
* g++.dg/warn/pragma-system_header1.C: New test.
* g++.dg/warn/pragma-system_header1.h. New.
Index: gcc/testsuite/g++.dg/warn/pragma-system_header1.C
===================================================================
--- gcc/testsuite/g++.dg/warn/pragma-system_header1.C (revision 0)
+++ gcc/testsuite/g++.dg/warn/pragma-system_header1.C (revision 0)
@@ -0,0 +1,10 @@
+// PR c++/30500
+// { dg-options "-Wconversion" }
+
+#include "pragma-system_header1.h"
+
+void f()
+{
+ g<int>();
+ h<int>();
+}
Index: gcc/testsuite/g++.dg/warn/pragma-system_header1.h
===================================================================
--- gcc/testsuite/g++.dg/warn/pragma-system_header1.h (revision 0)
+++ gcc/testsuite/g++.dg/warn/pragma-system_header1.h (revision 0)
@@ -0,0 +1,7 @@
+#pragma GCC system_header
+
+template <typename T>
+ int g() { return 0.0; }
+
+template <typename T>
+ T h() { return 0.0; }
Index: gcc/cp/pt.c
===================================================================
--- gcc/cp/pt.c (revision 123204)
+++ gcc/cp/pt.c (working copy)
@@ -13911,6 +13911,7 @@
mark_definable (d);
input_location = DECL_SOURCE_LOCATION (d);
+ in_system_header = DECL_IN_SYSTEM_HEADER (d);
/* If D is a member of an explicitly instantiated class template,
and no definition is available, treat it like an implicit