On 9/23/24 10:44 AM, Simon Martin wrote:
Hi Jason,

On 20 Sep 2024, at 18:01, Jason Merrill wrote:

On 9/20/24 5:21 PM, Simon Martin wrote:
The following code triggers an ICE

=== cut here ===
class base {};
class derived : virtual public base {
public:
    template<typename Arg> constexpr derived(Arg) {}
};
int main() {
    derived obj(1.);
}
=== cut here ===

The problem is that cxx_bind_parameters_in_call ends up attempting to

convert a REAL_CST (the first non artificial parameter) to
INTEGER_TYPE
(the type of the __in_chrg parameter), which ICEs.

This patch teaches cxx_bind_parameters_in_call to handle the
__in_chrg
and __vtt_parm parameters that {con,de}structors might have.

Note that in the test case, the constructor is not
constexpr-suitable,
however it's OK since it's a template according to my read of
paragraph
(3) of [dcl.constexpr].

Agreed.

It looks like your patch doesn't correct the mismatching of arguments
to parameters that you describe, but at least for now it should be
enough to set *non_constant_p and return if we see a VTT or in-charge
parameter.

Thanks, it’s true that my initial patch was wrong in that we’d leave
cxx_bind_parameters_in_call thinking the expression was actually a
constant expression :-/

The attached revised patch follows your suggestion (thanks!).
Successfully tested on x86_64-pc-linux-gnu. OK for trunk?

OK.

Reply via email to