[Bug c++/90769] Template instantiation recursion when trying to do a conversion template

2022-01-05 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90769

Patrick Palka  changed:

   What|Removed |Added

 CC||ppalka at gcc dot gnu.org

--- Comment #4 from Patrick Palka  ---
I think this issue can be distilled into the following testcase:

enum E { };

template
int f(E e) {
  return e + e;
}

int operator+(E, E) = delete; // #1

template int f(E);

For e + e, should ADL be performed at instantiation time and therefore find the
later-declared #1?  GCC, Clang and MSVC all appear to perform ADL here, and
they all reject this testcase.  I'm not sure but I think ADL shouldn't be
performed here since since the operator expression is non-dependent.

[Bug c++/90769] Template instantiation recursion when trying to do a conversion template

2019-06-05 Thread ensadc at mailnesia dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90769

ensadc at mailnesia dot com changed:

   What|Removed |Added

 CC||ensadc at mailnesia dot com

--- Comment #3 from ensadc at mailnesia dot com ---
It seems that `f == B` triggers overload resolution which treats `operator==`
declared latter as a candidate, which then causes the instantiation of the
constructor template, which requires overload resolution for `f == B`

Reduced:

enum E {B};

struct X
{
  template 
  constexpr X(int v);
};

bool operator==(X const& lhs, int) { 
return X(1);
}

[Bug c++/90769] Template instantiation recursion when trying to do a conversion template

2019-06-05 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90769

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-06-06
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Marek Polacek  ---
Not a regression, seems it's never worked.

[Bug c++/90769] Template instantiation recursion when trying to do a conversion template

2019-06-05 Thread barry.revzin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90769

--- Comment #1 from Barry Revzin  ---
Sorry, more reduced:

#include 

enum E {A, B};

struct X
{
  template  = 0>
  constexpr X(int v);

  template  = 0>
  operator OUT() const;
};

#ifdef WORKS
bool operator!=(X const& lhs, int) { 
return static_cast(lhs) == 0;
}
#else
bool operator==(X const& lhs, int) { 
return static_cast(lhs) == 0;
}
#endif