[llvm-bugs] [Bug 38294] New: compilation error when parameters have certain complexity

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 24 16:42:44 PDT 2018


            Bug ID: 38294
           Summary: compilation error when parameters have certain
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The code is as follow:

#define MAX(a,b) ((a) > (b) ? (a) : (b))
template<int W, bool S>
class mc_int {
 template<int W2, bool S2>
 mc_int<MAX(W+(S2&&!S),W2+(S&&!S2))+1, false> operator +(const mc_int<W2,S2>&
x) const;
typedef mc_int<6,false> ch_t;
template <int footemplate>
void foo_function(ch_t A, ch_t B, ch_t *C)
 A + B;

clang++ rejects it:

code2.cpp:11:4: error: 'operator+' is a private member of 'mc_int<6, false>'
 A + B;
 ~ ^ ~
code2.cpp:5:47: note: implicitly declared private here
 mc_int<MAX(W+(S2&&!S),W2+(S&&!S2))+1, false> operator +(const mc_int<W2...
1 error generated.

g++ accepts it without any warnings.

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/20180724/45860231/attachment.html>

More information about the llvm-bugs mailing list