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

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 13 11:57:56 PST 2017


rsmith added a comment.

In https://reviews.llvm.org/D38216#922768, @lichray wrote:

> 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?


That's almost right, but not all `extern` declarations are disallowed. (An `extern` declaration is still a defining declaration if it has an initializer.)



================
Comment at: lib/Sema/SemaDecl.cpp:10208
+    return DeduceTemplateSpecializationFromInitializer(
+      TSI, Entity, Kind, Init ? InitsCopy : MutableArrayRef<Expr*>());  
   }
----------------
Please put this `?:` expression into the declaration of `DeduceInits` instead of here. (We should build an empty list instead of a list of one null pointer when there is no init.)


https://reviews.llvm.org/D38216





More information about the cfe-commits mailing list