Title
Dependent non-type template arguments
Status
c++11
Section
13.8.3.4 [temp.dep.constexpr]
Submitter
Jason Merrill

Created on 2010-06-28.00:00:00 last changed 131 months ago

Messages

Date: 2011-03-15.00:00:00

[Voted into the WP at the March, 2011 meeting as part of paper N3262.]

Date: 2010-11-15.00:00:00

Proposed resolution (November, 2010) [SUPERSEDED]:

  1. Add a new paragraph at the end of 13.8.3.4 [temp.dep.constexpr]:

  2. An id-expression is value-dependent if it names a member of an unknown specialization.
  3. Change 13.8.3.5 [temp.dep.temp] paragraphs 2-3 as follows:

  4. An integral A non-type template-argument is dependent if its type is dependent or the constant expression it specifies is value-dependent.

    A non-integral Furthermore, a non-type template-argument is dependent if its type is dependent or it has either of the following forms

      qualified-id
      & qualified-id

    and contains a nested-name-specifier which specifies a class-name that names a dependent type the corresponding non-type template-parameter is of reference or pointer type and the template-argument designates or points to a member of the current instantiation or a member of a dependent type.

Date: 2010-06-28.00:00:00

Given

    template <const char *N> struct A { static const char *p; };
    template <class T>
       struct B { static const char c[1]; typedef A<B<T>::c> C; };
    template <class T>
       struct D { static const char c[1]; typedef A<c> C; };

13.8.3.5 [temp.dep.temp] says that B<T>::c is dependent because it is used as a non-integral non-type template argument and it is a qualified-id with a nested-name-specifier that names a dependent type.

There doesn't seem to be anything to say that c in the definition of D<T>::C is dependent, which suggests that D<T>::C is the same type for all T, which is clearly false.

Instead of this special rule in 13.8.3.5 [temp.dep.temp], 13.8.3.4 [temp.dep.constexpr] should say that the address of a member of a dependent type is value-dependent, regardless of whether the address is written with a qualified-id.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3396
2011-04-10 00:00:00adminsetstatus: review -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3110
2010-11-29 00:00:00adminsetstatus: drafting -> review
2010-06-28 00:00:00admincreate