https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68842
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4907,8 +4907,13 @@ cp_build_binary_op (location_t location, if (!result_type) { if (complain & tf_error) - error ("invalid operands of types %qT and %qT to binary %qO", - TREE_TYPE (orig_op0), TREE_TYPE (orig_op1), code); + { + error ("invalid operands of types %qT and %qT to binary %qO", + TREE_TYPE (orig_op0), TREE_TYPE (orig_op1), code); + if (code == LT_EXPR) + inform (input_location, "use the keyword %<template%> before the " + "name of a member template belonging to a dependent type"); + } return error_mark_node; } This patch adds the following line after the error: tt.cc:15:15: note: use the keyword ‘template’ before the name of a member template belonging to a dependent type I don't know how to make it only issue that note when the LHS is one of foo.bar, foo->bar, or foo::bar.