[llvm-bugs] [Bug 35496] New: Template argument-dependent lookup fails to find a function in unnamed namespace

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 1 05:49:29 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35496

            Bug ID: 35496
           Summary: Template argument-dependent lookup fails to find a
                    function in unnamed namespace
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: trupwszafie at o2.pl
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Created attachment 19507
  --> https://bugs.llvm.org/attachment.cgi?id=19507&action=edit
File reproducing the issue.

Template function fails to find operator>> overloading, when the operator>>
function is defined in unnamed namespace. Error message:

c1.cpp:16:9: error: call to function 'operator>>' that is neither visible in
the template definition nor found by argument-dependent lookup
    iss >> result;
        ^
c1.cpp:39:15: note: in instantiation of function template specialization
'Bar::convert<Bar::Foo>' requested here
  return !bar.convert("bar foo", foo);
              ^
c1.cpp:27:17: note: 'operator>>' should be declared prior to the call site or
in the global namespace
  std::istream& operator>>(std::istream& is, Bar::Foo& foo)

I think it should compile as unnamed namespace specifies internal linkage like
static keyword. When unnamed namespace is replaced with static keyword the code
compiles, so the behavior seems pretty inconsistent.

-- 
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/20171201/0fa9d093/attachment.html>


More information about the llvm-bugs mailing list