Boost logo

Boost :

Subject: Re: [boost] [Hana] Informal review request
From: Louis Dionne (ldionne.2_at_[hidden])
Date: 2015-03-05 16:28:36

Matt Calabrese <rivorus <at>> writes:

> On Thu, Mar 5, 2015 at 12:56 PM, Louis Dionne <ldionne.2 <at>> wrote:
> > Yes, this is already taken care of and no unfortunate instantiations
> > will take place.
> Awesome!!!
> > The downside is that `decltype(tuple_t<T...>)` is an
> > unspecified dependent type that only _inherits_ `_tuple<T...>`.
> > I'm playing with fire, I know . I read the process of ADL
> > very carefully when I thought about this, but it is also
> > possible that I'm exploiting a Clang bug. What do you think?
> Hmm, I think that really might be relying on a clang bug, but I don't have
> the standard in front of me right now. From my understanding, if you
> inherit from _tuple<T...>, then "T..." again needs to be considered for the
> list of associated namespaces.

I just checked on GCC and MSVC (online compilers) and it works too.
If you want to check for yourself, I wrote a gist at [1] that is a
self-contained test. Actually, I would appreciate if someone with
access to more exotic compilers (Intel for example) could try
compiling it just to make sure.

I also double-checked the standard (ok, [2]
to be fair). For what follows, let's denote by Hidden the type
`_tuple_t<T...>::_` as can be seen in the gist. Here's my reading
of it (the standardese is indented):

> [...] For every argument in a function call expression and for
> every template template argument of a template function, its
> type is examined to determine the associated set of namespaces
> and classes that it will add to the lookup
> 1) For arguments of fundamental type, the associated set of
> namespaces and classes is empty

We don't care, Hidden is not a fundamental type.

> 2) For arguments of class type (including union), the set consists of
> a) The class itself
> b) All of its direct and indirect base classes
> c) If the class is a member of another class, the class of
> which it is a member
> d) The innermost enclosing namespaces in the classes added to the set

a) We're ok; Hidden can be instantiated safely.
b) We're ok, `_tuple_t<T...>` can be instantiated safely.
c) We're ok; Hidden is a member of `_tuple_t<T...>`, but this can be
   instantiated safely.
d) Don't care.

> 3) For arguments whose type is a class template specialization, in
> addition to the class rules, the following types are examined and
> their associated classes and namespaces are added to the set
> a) [...]
> b) [...]
> c) [...]

We don't care about any of this, because Hidden is not a

> [bunch of other clauses that clearly do not apply to us]

So from my reading, it looks like we're good.



Boost list run by bdawes at, gregod at, cpdaniel at, john at