[llvm-bugs] [Bug 42888] New: template parameter lookup differs from g++ wrt. constness
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Aug 5 05:31:59 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42888
Bug ID: 42888
Summary: template parameter lookup differs from g++ wrt.
constness
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: dominik.strasser at onespin.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Created attachment 22338
--> https://bugs.llvm.org/attachment.cgi?id=22338&action=edit
Source code illustrating the problem
For the attached source file, clang++ errors out with
main.C:18:4: error: invalid operands to binary expression ('AA' and 'S<E, EV>')
a << x;
~ ^ ~
main.C:10:14: note: candidate template ignored: substitution failure [with E =
E]: deduced non-type template argument does not have the same type as the
corresponding template parameter ('E *' vs 'const E *')
friend AA& operator<<( AA& os, const S<E,V>& e );
g++ handles the template fine.
Removing the constness of the second operator parameter or adding constness to
the variable makes the problem disappear.
In my application a different operatow was chosen leading to a misbehavior.
--
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/20190805/2e6887d6/attachment.html>
More information about the llvm-bugs
mailing list