https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65882
Markus Trippelsdorf <trippels at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW Summary|Internal compiler error: |[5/6 Regression] Internal |Error reporting routines |compiler error: Error |re-entered |reporting routines | |re-entered --- Comment #3 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- markus@x4 tmp % cat json.ii template <bool> struct A { typedef int type; }; template <typename _Tp> struct numeric_limits { static constexpr _Tp max () { return 0; } }; template <> struct numeric_limits<long> { static constexpr int max () { return 5; } }; template <typename RHS, RHS rhs, typename LHS> void greater_than_impl (typename A<(rhs > numeric_limits<LHS>::max ())>::type) { } template <typename, int rhs, typename LHS> void greater_than (LHS) { greater_than_impl<int, rhs, LHS>; } struct B { long m_fn1 () const; template <class T> T m_fn2 () const; }; template <class, class Src> void to (Src value) { greater_than<long, numeric_limits<long>::max ()> (value); } bool asImpl___trans_tmp_1; template <class T> T B::m_fn2 () const { to<T> (asImpl___trans_tmp_1); }; long B::m_fn1 () const { m_fn2<long> (); } markus@x4 tmp % g++ -Wbool-compare -c -std=c++11 json.ii json.ii: In instantiation of ‘void greater_than(LHS) [with <template-parameter-1-1> = long int; int rhs = 5; LHS = bool]’: json.ii:38:52: required from ‘void to(Src) [with <template-parameter-1-1> = long int; Src = bool]’ json.ii:45:9: required from ‘T B::m_fn2() const [with T = long int]’ json.ii:50:16: required from here json.ii:22:41: warning: comparison of constant ‘5’ with boolean expression is always true [-Wbool-compare] void greater_than_impl (typename A<(rhs > numeric_limits<LHS>::max ())>::type) ^ json.ii:22:41: warning: comparison of constant ‘5’ with boolean expression is always true [-Wbool-compare] ‘ Internal compiler error: Error reporting routines re-entered. 0x611701 build_new_op_1 ../../gcc/gcc/cp/call.c:5691 0x61238e build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*, tree_node*, tree_node**, int) ../../gcc/gcc/cp/call.c:5750 0x73f5ce build_x_binary_op(unsigned int, tree_code, tree_node*, tree_code, tree_node*, tree_code, tree_node**, int) ../../gcc/gcc/cp/typeck.c:3805 0x676cda tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/gcc/cp/pt.c:14730 0x6663af tsubst_expr ../../gcc/gcc/cp/pt.c:14352 0x670f4c tsubst_template_arg ../../gcc/gcc/cp/pt.c:9654 0x66c26a tsubst_template_args ../../gcc/gcc/cp/pt.c:10205 0x682cb0 tsubst_aggr_type ../../gcc/gcc/cp/pt.c:10402 0x66e65d tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/gcc/cp/pt.c:12366 0x6f2b40 dump_template_bindings ../../gcc/gcc/cp/error.c:369 0x6f2b40 dump_substitution ../../gcc/gcc/cp/error.c:1448 0x6f6214 decl_to_string ../../gcc/gcc/cp/error.c:2910 0x6f6214 cp_printer ../../gcc/gcc/cp/error.c:3494 0x1350407 pp_format(pretty_printer*, text_info*) ../../gcc/gcc/pretty-print.c:613 0x1350c90 pp_format_verbatim(pretty_printer*, text_info*) ../../gcc/gcc/pretty-print.c:672 0x1350d6d pp_verbatim(pretty_printer*, char const*, ...) ../../gcc/gcc/pretty-print.c:875 0x6e84fa print_instantiation_full_context ../../gcc/gcc/cp/error.c:3273 0x6e84fa maybe_print_instantiation_context ../../gcc/gcc/cp/error.c:3417 0x6f4db3 cp_diagnostic_starter ../../gcc/gcc/cp/error.c:3109 0x134d499 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) ../../gcc/gcc/diagnostic.c:866 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.