[LLVMbugs] [Bug 19775] New: accidentally performing ADL on non-dependent operator calls during template instantiation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat May 17 23:20:13 PDT 2014


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

            Bug ID: 19775
           Summary: accidentally performing ADL on non-dependent operator
                    calls during template instantiation
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

As filed by Doug on GCC's bugzilla...

Clang and GCC both reject this valid code:

template<class T> struct wrap {};

template<typename T> bool& operator==(wrap<T>, wrap<T>);

template<typename T>
void g(T, wrap<wrap<int> > x)
{
  bool& b = x == x;
}

template<typename T> int& operator==(wrap<wrap<T> >, wrap<wrap<T> >);

void h()
{
  wrap<wrap<int> > x;
  g(17, x);
}


In Clang's case, we resolve the non-dependent == operator inside 'g' during the
template definition, but TreeTransform does the wrong thing and rebuilds the
operator using code that performs ADL. Oops...

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140518/66acc353/attachment.html>


More information about the llvm-bugs mailing list