[llvm-bugs] [Bug 47333] New: templetized operator<< isn't matched in a namespace
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Aug 27 10:25:12 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47333
Bug ID: 47333
Summary: templetized operator<< isn't matched in a namespace
Product: clang
Version: trunk
Hardware: PC
OS: FreeBSD
Status: NEW
Severity: enhancement
Priority: P
Component: C++17
Assignee: unassignedclangbugs at nondot.org
Reporter: yuri at tsoft.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
Created attachment 23900
--> https://bugs.llvm.org/attachment.cgi?id=23900&action=edit
testcase-templetized-operator-in-namespace.cpp
The attached testcase testcase-templetized-operator-in-namespace.cpp fails to
compile:
> testcase-templetized-operator-in-namespace.cpp:38:22: error: invalid operands to binary expression ('basic_ostream<char, std::__1::char_traits<char>>' and 'std::vector<int>')
> std::cout << " v=" << ee << std::endl;
> ~~~~~~~~~~~~~~~~~~ ^ ~~
The locally defined template "template<typename T> std::ostream&
operator<<(std::ostream &os, std::vector<T> &v)" isn't matched in a class
method.
However, removing the namespace X (flattening it), or removing the unrelated
"std::ostream& operator<<(std::ostream &os, E e)" make this code to compile.
The template should match regardless of the code being in a namespace, or
presence of operator<< for other types.
Observed on llvm-devel-12.0.d20200811 in FreeBSD 12.1
--
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/20200827/5bdb7c09/attachment-0001.html>
More information about the llvm-bugs
mailing list