[LLVMbugs] [Bug 13120] New: type 'A' does not provide a subscript operator

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 15 11:27:39 PDT 2012


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

             Bug #: 13120
           Summary: type 'A' does not provide a subscript operator
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hhinnant at apple.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


$cat test.cpp

#include <type_traits>

struct A
{
    int operator[](int) const;

    decltype(std::declval<A>()[0]) foo(int y) const
    {
        return (*this)[0]+y;
    }
};

int main()
{
}

$clang++ -stdlib=libc++ -std=c++11

test.cpp:7:31: error: type 'A' does not provide a subscript operator
    decltype(std::declval<A>()[0]) foo(int y) const
             ~~~~~~~~~~~~~~~~~^~
test.cpp:9:23: error: type 'const A' does not provide a subscript operator
        return (*this)[0]+y;
               ~~~~~~~^~
2 errors generated.

I expect this to compile.  But if I'm missing something, then the error message
needs to point me in the right direction.  It looks to me like 'A' *does*
provide a subscript operator.

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