[Bug c++/102157] floating-integral conversions is not permitted in the user-defined conversion sequence in converted constant expression

2021-09-01 Thread xmh970252187 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102157

--- Comment #2 from jim x  ---
bind the temporary is permitted here to me. Since the template parameter is not
a reference type, there is no restriction on whether a temporary object is
generated in the implicit conversion.

[Bug c++/102157] floating-integral conversions is not permitted in the user-defined conversion sequence in converted constant expression

2021-09-01 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102157

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2021-09-01

--- Comment #1 from Andrew Pinski  ---
There are two issues here really (both accepts invalid).
First is binding to a temp is invalid:
struct A{
constexpr A(double const ){}
};
template
struct C{};
int main() {
C b;
}
- CUT 
Second is the conversion is also invalid:
struct A{
constexpr A(double rf){}
};
template
struct C{};
int main() {
C b;
}