[LLVMbugs] [Bug 9919] New: error: binding of reference to type 'A' to a value of type 'A' drops qualifiers

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat May 14 14:29:26 PDT 2011


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

           Summary: error: binding of reference to type 'A' to a value of
                    type 'A' drops qualifiers
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hhinnant at apple.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


I believe this is well-formed code.

struct A {};

template <class _R, class ..._Param, class ..._Args>
inline
_R
__invoke(_R (*__f)(_Param...), _Args&& ...__args)
{
    return __f(static_cast<_Args&&>(__args)...);
}

template <class _F, class _BoundArgs>
inline
A
__apply_functor(_F& __f, _BoundArgs __bound_args)
{
    return ::__invoke(__f, __bound_args);
}


A f4(A&& p)
{
    return static_cast<A&&>(p);
}

int main()
{
    ::__apply_functor(f4, A());
}


test.cpp:9:16: error: binding of reference to type 'A' to a value of type 'A'
drops qualifiers
    return __f(static_cast<_Args&&>(__args)...);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cpp:17:12: note: in instantiation of function template specialization
'__invoke<A, A &&, A &>' requested here
    return ::__invoke(__f, __bound_args);
           ^
test.cpp:28:5: note: in instantiation of function template specialization
'__apply_functor<A (A &&), A>' requested here
    ::__apply_functor(f4, A());
    ^
1 error generated.


Apple clang version 3.0 (trunk 131335) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin10.7.0
Thread model: posix

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