<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang may not compile Chromium code"
   href="https://bugs.llvm.org/show_bug.cgi?id=38293">38293</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang may not compile Chromium code
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>zhonghao@pku.org.cn
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>A user complained that gcc cannot compile the Chromium code. The bug report is:

<a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64251">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64251</a>

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@x4 /tmp % checking-release/g++ -std=c++11 -c foo.ii
markus@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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>