[llvm-bugs] [Bug 38293] New: clang may not compile Chromium code

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 24 16:20:28 PDT 2018


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

            Bug ID: 38293
           Summary: clang may not compile Chromium code
           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

A user complained that gcc cannot compile the Chromium code. The bug report is:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64251

The reduced code is as follow:

class DictionaryValue {};
template <typename T> void CreateValue(T) {
          DictionaryValue(0);
            CreateValue(0);
}

gcc 5.0 produces the following error messages:

markus at x4 /tmp % checking-release/g++ -std=c++11 -c foo.ii
markus at x4 /tmp % checking-yes/g++ -std=c++11 -c foo.ii
foo.ii: In instantiation of ‘void CreateValue(T) [with T = int]’:
foo.ii:4:17:   required from here
foo.ii:3:4: error: no matching function for call to
‘DictionaryValue::DictionaryValue(int)’
    DictionaryValue(0);
    ^
foo.ii:1:7: note: candidate: constexpr DictionaryValue::DictionaryValue()
 class DictionaryValue {};
       ^
foo.ii:1:7: note:   candidate expects 0 arguments, 1 provided
foo.ii:1:7: note: candidate: constexpr DictionaryValue::DictionaryValue(const
DictionaryValue&)
foo.ii:1:7: note:   no known conversion for argument 1 from ‘int’ to ‘const
DictionaryValue&’
foo.ii:1:7: note: candidate: constexpr
DictionaryValue::DictionaryValue(DictionaryValue&&)
foo.ii:1:7: note:   no known conversion for argument 1 from ‘int’ to
‘DictionaryValue&&’

After the bug is fixed, the latest gcc accepts the code. 

I tried clang++ to compile the reduced code. It reports the following error:

code0.cpp:3:2: error: no matching conversion for functional-style cast from
      'int' to 'DictionaryValue'
 DictionaryValue(0);
 ^~~~~~~~~~~~~~~~~
code0.cpp:1:7: note: candidate constructor (the implicit copy constructor) not
      viable: no known conversion from 'int' to 'const DictionaryValue' for 1st
      argument
class DictionaryValue {};
      ^
code0.cpp:1:7: note: candidate constructor (the implicit move constructor) not
      viable: no known conversion from 'int' to 'DictionaryValue' for 1st
      argument
class DictionaryValue {};
      ^
code0.cpp:1:7: note: candidate constructor (the implicit default constructor)
      not viable: requires 0 arguments, but 1 was provided
1 error generated.


Even if it is not a bug in clang, it indicates that clang cannot compile the
Chromium code either, which needs to be repaired.

-- 
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/32b48ffb/attachment.html>


More information about the llvm-bugs mailing list