[Bug libstdc++/84769] New: variant::get(): unscoped call to get<size_t>

duarte at scylladb dot com gcc-bugzilla@gcc.gnu.org
Thu Mar 8 22:19:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84769

            Bug ID: 84769
           Summary: variant::get(): unscoped call to get<size_t>
           Product: gcc
           Version: 7.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: duarte at scylladb dot com
  Target Milestone: ---

In the implementation of T& get(variant<Types...>& v) and friends, the calls to
the size_t-templated overloads of get is unscoped, like in [1]. This can lead
to surprising situations if a similar function is available in the current
namespace (say, to provide a common interface between <variant> and
<boost/variant.hpp>). 

I'm not aware of the standard requiring get() to be an extension point, so
maybe the calls should be scoped?

[1]
https://github.com/gcc-mirror/gcc/blob/master/libstdc++-v3/include/std/variant#L922


More information about the Gcc-bugs mailing list