Title
Conflict of templated entity vs. enclosing template
Status
open
Section
13.8.1 [temp.res.general]
Submitter
Egor Mikhailov

Created on 2026-08-12.00:00:00 last changed 6 days ago

Messages

Date: 2026-08-30.07:45:22

Suggested resolution:

Change in 13.8.1 [temp.res.general] bullet 6.1 as follows:

The program is ill-formed, no diagnostic required, if
  • no valid specialization, ignoring static_assert-declarations that fail (9.1 [dcl.pre]), can be generated for a templated entity or a substatement of a constexpr if statement (8.5.2 [stmt.if]) within a templated entity and the innermost enclosing template that templated entity or substatement is not instantiated, or
  • ...
Date: 2026-08-12.00:00:00

(From submission #973.)

Consider:

  template <typename T>
  struct Foo
  {
    Foo() {}
    Foo(T) {
      this->bar(); // IFNDR here?
    }
  };

  Foo<int> f;

This ought to be IFNDR, but the enclosing template is, in fact, instantiated. However, the definition of Foo(T) is not instantiated.

History
Date User Action Args
2026-08-30 07:45:22adminsetmessages: + msg8668
2026-08-12 00:00:00admincreate