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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to