[PATCH] D38216: [C++17] Fix class template argument deduction for default constructors without an initializer

Zhihao Yuan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 11 12:55:55 PST 2017

lichray added a comment.

In https://reviews.llvm.org/D38216#922709, @Rakete1111 wrote:

> @lichray Isn't [dcl.type.auto.deduct] only for `auto` and `decltype(auto)`?

Sorry, reasoned on a confusingly similar part... Here is
updated information:

> [dcl.type.class.deduct]
>  If a placeholder for a deduced class type appears as a decl-specifier in
>  the decl-specifier-seq of an initializing declaration (11.6) of a variable,
>  [...].

> 11.6 [dcl.init]/22
>  A declaration that specifies the initialization of a variable, whether from
>  an explicit initializer or by default initialization, is called the initializing
>  declaration of that variable. [ Note: In most cases this is the defining
>  declaration (6.1) of the variable, but the initializing declaration of a non-
>  inline static data member ( might be the declaration within the
>  class definition and not the definition at namespace scope. —end note ]

So deducing from default initialization is indeed allowed, but `extern`
could be interpreted as outlawed because similar to the case of non-
inline static data member, where the declaration doesn't give **the**
initialization of that variable.  @rsmith, comments?


More information about the cfe-commits mailing list