[LLVMbugs] [Bug 13983] New: bug in template parameter lookup

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 1 02:13:34 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13983

             Bug #: 13983
           Summary: bug in template parameter lookup
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: vanyacpp at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Clang rejects the following code:

struct x
{
    struct V;

    template <typename U>
    void f();
};

template <typename V>
void x::f()
{
    V(); // V is resolved to x::V, not template parameter V
}

int main()
{
    x x;
    x.f<int>();
}

[temp.local]p7: In the definition of a member of a class template that appears
outside of the class template definition, the name of a member of the class
template hides the name of a template-parameter of any enclosing class
templates (but not a template-parameter of the member if the member is a class
or function template).

Because of that Clang unable to compile example from [temp.local]p7:

template<class T>
struct A
{
    struct B {};
    typedef void C;
    template<class U> void g(U);
};

template<class B>
template<class C>
void A<B>::g(C)
{}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list