Title
Pointer to array of unknown bound in template argument list in parameter
Status
cd4
Section
9.3.4.6 [dcl.fct]
Submitter
Mark Mitchell

Created on 2002-12-12.00:00:00 last changed 88 months ago

Messages

Date: 2014-11-15.00:00:00

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

Date: 2014-02-15.00:00:00

Proposed resolution (February, 2014):

Change 9.3.4.6 [dcl.fct] paragraph 8 as follows, including deleting the footnote:

If the type of a parameter includes a type of the form “pointer to array of unknown bound of T” or “reference to array of unknown bound of T,” the program is ill-formed.101 Functions shall not have a return type of type array or function, although...
Date: 2013-01-15.00:00:00

Additional note (January, 2013):

Additional discussion of this issue has arisen . For example, the following is permissible:

  T (*p) [] = (U(*)[])0;

but the following is not:

  template<class T>
  void sp_assert_convertible( T* ) {}

  sp_assert_convertible<T[]>( (U(*)[])0 );
Date: 2003-04-15.00:00:00

Notes from April 2003 meeting:

We agreed that the example should be allowed.

Date: 2002-12-12.00:00:00

EDG rejects this code:

  template <typename T>
  struct S {};

  void f (S<int (*)[]>);
G++ accepts it.

This is another case where the standard isn't very clear:

The language from 9.3.4.6 [dcl.fct] is:

If the type of a parameter includes a type of the form "pointer to array of unknown bound of T" or "reference to array of unknown bound of T," the program is ill-formed.
Since "includes a type" is not a term defined in the standard, we're left to guess what this means. (It would be better if this were a recursive definition, the way a type theoretician would do it:
  • Every type includes itself.
  • T* includes T
  • T[] includes T
  • ...
)

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5374
2014-11-24 00:00:00adminsetstatus: ready -> dr
2014-03-03 00:00:00adminsetmessages: + msg4828
2014-03-03 00:00:00adminsetstatus: open -> ready
2013-09-03 00:00:00adminsetstatus: drafting -> open
2013-01-14 00:00:00adminsetmessages: + msg4210
2003-04-25 00:00:00adminsetmessages: + msg839
2003-04-25 00:00:00adminsetstatus: open -> drafting
2002-12-12 00:00:00admincreate