Movatterモバイル変換


[0]ホーム

URL:


Issue 1770 - WG21 CWG Issues
Title
Type matching of non-type template parameters and arguments
Status
c++14
Section
13.10.3.6 [temp.deduct.type]
Submitter
Canada

Created on2013-09-24.00:00:00 last changed136 months ago

Messages

msg4968 (view)
Date: 2014-02-15.00:00:00

[Moved to DR at the February, 2014 meeting.]

msg4604 (view)
Date: 2013-09-15.00:00:00

Proposed resolution (September, 2013):

Change 13.10.3.6 [temp.deduct.type] paragraph 17 as follows:

If, in the declaration of a function template with anon-typetemplate-parameter, the non-typetemplate-parameteris used in an expression in the function parameter-list and, if thecorrespondingtemplate-argument is deduced,thetemplate-argument type shall match the type ofthetemplate-parameter exactly, except thatatemplate-argument deduced from an array bound may be of anyintegral typeP has a form thatcontains<i>, and if the type of the corresponding valueofA differs from the type ofi, deductionfails. IfP has a form that contains[i], and if the typeofi is not an integral type, deduction fails.147[Example:...
msg4603 (view)
Date: 2013-09-24.00:00:00
N3690 comment CA 15

According to 13.10.3.6 [temp.deduct.type] paragraph 17,

If, in the declaration of a function template with anon-typetemplate-parameter, the non-typetemplate-parameteris used in an expression in the function parameter-list and, if thecorrespondingtemplate-argument is deduced,thetemplate-argument type shall match the type ofthetemplate-parameter exactly, except thatatemplate-argument deduced from an array bound may be of anyintegral type.

This does not cover return types, leaving the outcome of an examplelike the following unclear:

  template <int N> struct A;  template <short N>  A<N> *foo();  void bar() {    A<1> *(*fp)(void) = &foo;  }
History
DateUserActionArgs
2014-11-24 00:00:00adminsetstatus: dr -> c++14
2014-03-03 00:00:00adminsetmessages: +msg4968
2014-03-03 00:00:00adminsetstatus: ready -> dr
2013-10-14 00:00:00adminsetmessages: +msg4604
2013-09-24 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp