Title
Does a reference type have a destructor?
Status
concepts
Section
_N2914_.14.10.2.1 [concept.map.fct]
Submitter
James Widman

Created on 2009-06-12.00:00:00 last changed 24 months ago

Messages

Date: 2020-12-15.00:00:00

Is the following well-formed?

    auto concept HasDestructor<typename T> {
      T::~T();
    }

    concept_map HasDestructor<int&> { }

According to _N2914_.14.10.2.1 [concept.map.fct] paragraph 4, the destructor requirement in the concept map results in an expression x.~X(), where X is the type int&. According to _N4778_.7.6.1.4 [expr.pseudo], this expression is ill-formed because the object type and the type-name must be the same type, but the object type cannot be a reference type (references are dropped from types used in expressions, Clause 7 [expr] paragraph 5).

It is not clear whether this should be addressed by changing _N4778_.7.6.1.4 [expr.pseudo] or _N2914_.14.10.2.1 [concept.map.fct].

History
Date User Action Args
2022-04-30 06:44:58adminsetstatus: open -> concepts
2009-06-12 00:00:00admincreate