https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78908

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Interesting.  The patch in question just delays overloaded operator call
resolution to template instantiation time as opposed to template definition
time, like what was already being done for regular function calls.  It makes
the compiler more consistent by making uses of overloaded operators within
templates behave the same as explicit calls to the operatorX() functions with
respect to overload resolution.  I'll try to understand this regression.

First off if I replace the uses of overloaded operators with explicit calls to
the operatorX() functions then the ICE goes away.  In fact it looks like only
the use of << on line 62 needs to be kept order to trigger the ICE.

--- a/78908-orig.C
+++ b/78908.C
@@ -51,7 +51,7 @@ struct H {
   template <typename T> void insert(T const &);
   decltype(__trans_tmp_4) wep_;
 };
-template <typename T> void H::insert(T const &) { wep_->emplace<T, int>(); }
+template <typename T> void H::insert(T const &) {
wep_.operator->()->emplace<T, int>(); }
 template <typename> struct L {
   template <typename T> void insert(T const &);
   I backend_;
@@ -62,7 +62,7 @@ template <typename Tag> template <typename T> void
L<Tag>::insert(T const &p1) {
 G<L<int>> b, c;
 template <typename T_ENCODER>
 void O<T_ENCODER>::on_inner_remove(unsigned long, A const &p2) try {
-  b << p2.depth;
+  operator<< (b, p2.depth);
 } catch (...) {
 }
 struct M;
@@ -84,7 +84,7 @@ template <unsigned long TBookDepth> int const
*N<TBookDepth>::process() {
 }
 template <unsigned long TBookDepth>
 void N<TBookDepth>::process(int const &, int const &, unsigned short) try {
-  c << expected_detail_level_;
+  operator<<(c, expected_detail_level_);
 } catch (...) {
 }
 template <unsigned long TBookDepth>

Reply via email to