Title
Newly-ambiguous variadic template expansions
Status
c++17
Section
13.7.4 [temp.variadic]
Submitter
Daniel Krügler

Created on 2011-12-17.00:00:00 last changed 25 months ago

Messages

Date: 2022-11-20.07:54:16

CWG 2022-11-11

Resolved by issue 1395; see the special rule about trailing packs in 13.10.3.5 [temp.deduct.partial] paragraph 11.

Date: 2012-10-15.00:00:00

Notes from the October, 2012 meeting:

It is possible that 13.7.6.3 [temp.spec.partial.order] may resolve this problem.

Date: 2016-11-15.00:00:00

[Resolved by issue 1395, which was moved to DR at the November, 2016 meeting.]

With the new core rules in regard to variadic pack expansions the library specification of the traits template common_type is now broken, the reason is that it is defined as a series of specializations of the primary template

    template <class ...T>
    struct common_type;

The broken one is this pair:

  template <class T, class U>
  struct common_type<T, U> {
   typedef decltype(true ? declval<T>() : declval<U>()) type;
  };

  template <class T, class U, class... V>
  struct common_type<T, U, V...> {
   typedef typename common_type<typename common_type<T, U>::type, V...>::type type;
  };

With the new rules both specializations would now be ambiguous for an instantiation like common_type<X, Y>.

(See also issue 1395.)

History
Date User Action Args
2022-11-20 07:54:16adminsetmessages: + msg7033
2022-11-20 07:54:16adminsetstatus: open -> c++17
2022-02-18 07:47:23adminsetstatus: drafting -> open
2012-11-03 00:00:00adminsetmessages: + msg4104
2012-11-03 00:00:00adminsetstatus: open -> drafting
2011-12-17 00:00:00admincreate