[v3 PATCH] Implement P0504R0 (Revisiting in-place tag types for any/optional/variant).

Jonathan Wakely jwakely@redhat.com
Sun Nov 13 21:10:00 GMT 2016


On 13/11/16 21:02 +0000, Jonathan Wakely wrote:
>On 12/11/16 21:24 +0200, Ville Voutilainen wrote:
>>+  inline in_place_t in_place{};
>>+
>>+  template<typename _Tp> struct in_place_type_t
>>+  {
>>+    explicit in_place_type_t() = default;
>>+  };
>>+
>>+  template<typename _Tp>
>>+    in_place_type_t<_Tp> in_place_type{};
>>+
>>+  template<size_t _Idx> struct in_place_index_t
>>+  {
>>+    explicit in_place_index_t() = default;
>>+  };
>>+
>>+  template<size_t _Idx>
>>+    in_place_index_t<_Idx> in_place_index{};
>
>I was told there's a Core issue that says these are not actually
>inline variables unless they say "inline". Not sure which issue that
>is, but G++ does the right thing and makes them globally unique,
>rather than having internal linkage.
>
>(At LWG's request P0504R0 marked them inline just to be safe.)
>
>OK for trunk, thanks.

Oh, they aren't actually constexpr in your patch, so non-const, and so
don't get internal linkage. But they *should* be constexpr, please add
that to all three, and add inline to the two variable templates.




More information about the Libstdc++ mailing list