This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH]: Incomplete explicit args


Jason Merrill wrote:

The resulting substituted and adjusted function type is used as the type of the function template for template argument deduction.

which to me means that when we see f<1>, we use "R<Trait<1,x>::m> f(A<x>)"
in further deduction.  That seems pretty clear to me.  What alternative are
you suggesting?

We shouldn't look up m because it is still dependent.  uses_template_parms
is an approximation of the dependency check; I think we should be able to
do better by making the substitution work more like parsing.
Yup. I agree with you.

By stunning coincidence, I've just been pointed at 11347, which turns out to
be the same problem.
template <class T> struct T1 { enum {N}; };

template<class T> struct T2 {
  template <class S, bool Z = T1<S>::N + 1> struct B {};
};

T2<int> t;

In T2<int> we tsubst the template decl T2<int>::B and its default arg,
'T1<S>::N + 1'. There there arg outer vec is [int], but the inner one
is [S, Z], so the resultant type is still dependent, T1<S>, and we
should not lookup the name, but rebuild the scope_ref. Notice that checking
for template_parms in tsubst_expr would not catch this case -- we
can only find it during tsubst_qualified_id.  That leads me to think that
any caller of tsubst_copy_and_build must be prepared to get a dependent
expression back.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
         The voices in my head said this was stupid too
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]