Patchwork Avoid g++.dg/template/cond2.C fail

login
register
mail settings
Submitter Paolo Carlini
Date Sept. 9, 2013, 6:02 p.m.
Message ID <522E0D47.1070602@oracle.com>
Download mbox | patch
Permalink /patch/273627/
State New
Headers show

Comments

Paolo Carlini - Sept. 9, 2013, 6:02 p.m.
Hi,

thus the below is what I actually tested on x86_64-linux. I think we 
discuss already most of it.

Thanks!
Paolo.

////////////////////
2013-09-09  Jan Hubicka  <jh@suse.cz>
	    Paolo Carlini  <paolo.carlini@oracle.com>

	* cgraphunit.c (analyze_functions): Save input_location, set it
	to UNKNOWN_LOCATION and restore it at the end.

/cp
2013-09-09  Jan Hubicka  <jh@suse.cz>
	    Paolo Carlini  <paolo.carlini@oracle.com>

	* error.c (print_instantiation_partial_context_line): If
	loc == UNKNOWN_LOCATION return immediately.

/testsuite
2013-09-09  Jan Hubicka  <jh@suse.cz>
	    Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/template/cond2.C: Tweak, do not expect a "required from".

Patch

Index: cgraphunit.c
===================================================================
--- cgraphunit.c	(revision 202405)
+++ cgraphunit.c	(working copy)
@@ -916,9 +916,11 @@  analyze_functions (void)
   int i;
   struct ipa_ref *ref;
   bool changed = true;
+  location_t saved_loc = input_location;
 
   bitmap_obstack_initialize (NULL);
   cgraph_state = CGRAPH_STATE_CONSTRUCTION;
+  input_location = UNKNOWN_LOCATION;
 
   /* Ugly, but the fixup can not happen at a time same body alias is created;
      C++ FE is confused about the COMDAT groups being right.  */
@@ -1099,6 +1101,8 @@  analyze_functions (void)
      used by it.  */
   if (!seen_error ())
     symtab_initialize_asm_name_hash ();
+
+  input_location = saved_loc;
 }
 
 /* Translate the ugly representation of aliases as alias pairs into nice
Index: cp/error.c
===================================================================
--- cp/error.c	(revision 202405)
+++ cp/error.c	(working copy)
@@ -3200,9 +3200,11 @@  print_instantiation_partial_context_line (diagnost
 					  const struct tinst_level *t,
 					  location_t loc, bool recursive_p)
 {
-  expanded_location xloc;
-  xloc = expand_location (loc);
+  if (loc == UNKNOWN_LOCATION)
+    return;
 
+  expanded_location xloc = expand_location (loc);
+
   if (context->show_column)
     pp_verbatim (context->printer, _("%r%s:%d:%d:%R   "),
 		 "locus", xloc.file, xloc.line, xloc.column);
Index: testsuite/g++.dg/template/cond2.C
===================================================================
--- testsuite/g++.dg/template/cond2.C	(revision 202405)
+++ testsuite/g++.dg/template/cond2.C	(working copy)
@@ -6,5 +6,5 @@  template<int X> class c;
 template<int X, int Y> int test(c<X ? : Y>&); // { dg-error "omitted" }
 
 void test(c<2>*c2) {
-	test<0, 2>(*c2); // { dg-message "required" }
+	test<0, 2>(*c2);
 }