View | Details | Return to bug 22238
Collapse All | Expand All

(-)a/gcc/cp/call.c (-2 / +3 lines)
Lines 9614-9621 perform_implicit_conversion_flags (tree type, tree expr, Link Here
9614
	  else if (invalid_nonstatic_memfn_p (loc, expr, complain))
9614
	  else if (invalid_nonstatic_memfn_p (loc, expr, complain))
9615
	    /* We gave an error.  */;
9615
	    /* We gave an error.  */;
9616
	  else
9616
	  else
9617
	    error_at (loc, "could not convert %qE from %qT to %qT", expr,
9617
	    error_at
9618
		      TREE_TYPE (expr), type);
9618
	      (loc, "value of type %qT is not contextually convertible to %qT",
9619
	       TREE_TYPE (expr), type);
9619
	}
9620
	}
9620
      expr = error_mark_node;
9621
      expr = error_mark_node;
9621
    }
9622
    }
(-)a/gcc/testsuite/g++.dg/warn/pr22238-1.C (-1 / +17 lines)
Line 0 Link Here
0
- 
1
// { dg-options "-fdiagnostics-show-caret" }
2
3
struct A
4
{
5
  void foo();
6
};
7
8
struct B : virtual A
9
{
10
  void bar() { if (foo ()) ; } // { dg-error "value of type .void. is not contextually convertible to .bool." }
11
};
12
13
/* { dg-begin-multiline-output "" }
14
   void bar() { if (foo ()) ; }
15
                    ~~~~^~
16
   { dg-end-multiline-output "" } */
17

Return to bug 22238