Hi,

template<typename T>struct A
{
    int foo;
    struct B : A { using A::foo; }; // (1)
    struct C : A<T> { using A::foo; }; // (2)
};

There are two problems in this PR. Firstly, for (1)  it seems to work,
but in reality the lookup for foo is not performed. Hence, I have
modified dfs_lookup_base so that (1) and (2) be treated equivalently.
For (2), the lookup was failing because the flag
BINFO_DEPENDENT_BASE_P was set. It think it should not be set for this
special case, however, I'm not sure I have unset it at the right
place. A slight tweak was also needed in lookup_field_r so that (1)
work correctly.

Tested x86_64-unknown-linux-gnu without regressions.

gcc/testsuite/ChangeLog

2012-02-16  Fabien Chêne  <fab...@gcc.gnu.org>

        * g++.dg/template/using21.C: New.
        * g++.dg/template/using22.C: Likewise.

gcc/cp/ChangeLog

2012-02-16  Fabien Chêne  <fab...@gcc.gnu.org>

        * search.c (dfs_lookup_base): call TYPE_MAIN_VARIANT.
        (lookup_field_r): Likewise.
        * name-lookup.c (do_class_using_decl): Reset the flag
        BINFO_DEPENDENT_BASE_P so that the call to lookup_member succeed.

-- 
Fabien

Attachment: 52126.patch
Description: Binary data

Reply via email to