C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: Defect Report 115: Address of template-id
From: Maris Razvan (razvyboy2004_at_[hidden])
Date: 2019-07-30 09:48:54


Thank you for your answer.

Completeness may indeed be the reason why contexts where deduction
fails are mentioned.

However, in my opinion, the standard would be complete even without
this mention. This is because [over.over] p. 2 stated implicitly
(before this defect report) that if deduction fails, nothing is added
to the set of overloaded functions.

After this defect report, if deduction fails. the "overload
resolution" succeeds and the error is just moved further down the
line, as in the following example:

    template <typename T = void>
    void f(const T*);

    int main()
    {
        void (*pf) (void*);

        pf = f<>;
    }

Before the defect report the program was ill-formed because overload
resolution failed. After the defect report the program is ill-formed
because it assigns a pointer to function of type A (void (const
void*)) to a pointer to function of type B (void (void*)).

On Tue, Jul 30, 2019 at 4:21 PM Tadeus Prastowo
<tadeus.prastowo_at_[hidden]> wrote:
>
> On Tue, Jul 23, 2019 at 6:43 PM Maris Razvan via Std-Discussion
> <std-discussion_at_[hidden]> wrote:
> > Why do contexts where deduction fails have to be mentioned explicitly
> > in the standard?
>
> For the sake of completeness to make things easier to be worked out?
>
> --
> Best regards,
> Tadeus


STD-DISCUSSION list run by herb.sutter at gmail.com

Older Archives on Google Groups