Title
Incorrect example for ill-formed non-type template arguments
Status
c++23
Section
13.10.3.1 [temp.deduct.general]
Submitter
US

Created on 2022-11-03.00:00:00 last changed 17 months ago

Messages

Date: 2022-11-08.20:26:48

Proposed resolution (approved by CWG 2022-11-08):

Change in 13.10.3.1 [temp.deduct.general] bullet 11.8 as follows:

  • ...
  • Attempting to give an invalid type to a non-type template parameter. [Example 13:
      template <class T, T> struct S {};
      template <class T> int f(S<T, T()T{}>*);   // #1
      class X {
        int m;
      };
      int i0 = f<X>(0);   // #1 uses a value of non-structural type X as a non-type template argument
    
    -- end example ]
  • ...
Date: 2022-11-27.21:00:25
P2720R0 comment USĀ 28-068

[Accepted as a DR at the November, 2022 meeting.]

The example intends to illustrate that a class type cannot be the type of a non-type template parameter (although the example is still ill-formed because "T()" is interpreted as a function type).

History
Date User Action Args
2023-07-16 13:00:43adminsetstatus: open -> c++23
2023-07-16 13:00:43adminsetstatus: drwp -> open
2023-02-18 18:43:04adminsetstatus: dr -> drwp
2022-11-25 05:14:04adminsetstatus: nb -> dr
2022-11-08 20:26:48adminsetstatus: open -> nb
2022-11-08 20:26:48adminsetstatus: open -> open
2022-11-08 20:26:48adminsetstatus: open -> open
2022-11-08 20:26:48adminsetstatus: open -> open
2022-11-08 20:26:48adminsetmessages: + msg6987
2022-11-08 13:46:41adminsetstatus: nb -> open
2022-11-08 13:46:41adminsetstatus: nb -> nb
2022-11-08 13:46:41adminsetstatus: nb -> nb
2022-11-03 00:00:00admincreate