[LLVMbugs] [Bug 8368] New: Compiler getting confused when using templated function from the return value of a function of a member

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 12 19:47:01 PDT 2010


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

           Summary: Compiler getting confused when using templated
                    function from the return value of a function of a
                    member
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: psycocyril at yahoo.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The following code fails to compile (see comments)

namespace bug
{
class A
{
public:
    template<typename T> T foo(void) const;
};

class B
{
public:

    A& get_A() const;

};

template<typename D>
class C
{
private:
    B & m_b;

public:

    C(B & b)
        : m_b(b)
    {
    }

    int bar(void)
    {
        return m_b.get_A().foo<int>();
        // fails with:
        // error: use 'template' keyword to treat 'foo' as a dependent template
name
        //   return m_b.get_A().foo<int>();
        //                      ^
        //                      template 
        // works with:
        //A& a= m_b.get_A();
        //return a.foo<int>();
    }
};
}

-- 
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