Title
Does type-dependent imply value-dependent?
Status
cd4
Section
13.8.3.4 [temp.dep.constexpr]
Submitter
Richard Smith

Created on 2015-01-09.00:00:00 last changed 49 months ago

Messages

Date: 2016-03-15.00:00:00

Proposed resolution (March, 2016):

This issue is resolved by the resolution of issue 2109.

Date: 2015-09-15.00:00:00

Proposed resolution (September, 2015) [SUPERSEDED]:

Change 13.8.3.4 [temp.dep.constexpr] paragraph 4 as follows:

Expressions of the following form are value-dependent:

    sizeof ... ( identifuer )
    this
    fold-expression
Date: 2016-02-15.00:00:00

[Adopted at the February, 2016 meeting.]

Consider the following example:

  template<int> struct X { typedef int type; };
  template<typename T> struct Y {
    void f() { X<false ? this - this : 0>::type x; } // missing typename?
  };
  void g() { Y<void>().f(); }

This appears to be valid because the template argument expression is not value-dependent.

Until I discovered this, I had been assuming that any type-dependent expression is also value-dependent. The only exception to that appears to be the expression this, which may be type-dependent but is never value-dependent.

Now, this need not ever be value-dependent, because evaluation of it will never succeed when it appears as a subexpression of an expression that we're checking for constant-expression-ness. But if that's really what we want here, then the same applies to function parameters with dependent types, and probably a few other cases.

History
Date User Action Args
2017-02-06 00:00:00adminsetmessages: + msg6107
2017-02-06 00:00:00adminsetstatus: tentatively ready -> cd4
2015-11-10 00:00:00adminsetmessages: + msg5611
2015-11-10 00:00:00adminsetstatus: drafting -> tentatively ready
2015-01-09 00:00:00admincreate