3142. std::foo<incomplete> should be ill-formed NDR

Section: 16.4.5.8 [res.on.functions] Status: New Submitter: Casey Carter Opened: 2018-07-07 Last modified: 2018-11-27

Priority: 3

View all other issues in [res.on.functions].

View all issues with New status.

Discussion:

16.4.5.8 [res.on.functions]/2 states:

-2- In particular, the effects are undefined in the following cases:

[…]

(2.5) — if an incomplete type (6.8 [basic.types]) is used as a template argument when instantiating a template component or evaluating a concept, unless specifically allowed for that component.

While undefined behavior is appropriate for the other cases specified in the earlier bullets, which describe failure to meet (runtime) semantic requirements, "instantiating a template component or evaluating a concept" with an incomplete type happens at compile-time, and could potentially be diagnosed. It would therefore be more appropriate to specify that programs which do so are ill-formed with no diagnostic required.

[2018-11 Reflector prioritization]

Set Priority to 3

Proposed resolution:

This wording is relative to N4762.

Change 16.4.5.8 [res.on.functions] as indicated:

(2.5) — if an incomplete type (6.8 [basic.types]) is used as a template argument when instantiating a template component or evaluating a concept, unless specifically allowed for that component.

-?- Unless explicitly stated otherwise, a program that instantiates a template component or evaluates a concept with an incomplete type (6.8 [basic.types]) as a template argument is ill-formed with no diagnostic required.