<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - "Function is marked as dllimport, but not external" error after clang tries to drop dllimport attribute"
   href="http://llvm.org/bugs/show_bug.cgi?id=20792">20792</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"Function is marked as dllimport, but not external" error after clang tries to drop dllimport attribute
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>hans@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code:

  __declspec(dllimport) int f(int x);
  int user(int x) {
    return f(x);
  }
  int f(int x) { return 1; }

Compiled with:

  clang -cc1 -triple -i686-pc-win32 -emit-obj a.cc

Results in this output:

  a.cc:5:5: warning: 'f' redeclared without 'dllimport' attribute: previous
'dllimport' ignored
  int f(int x) { return 1; }
      ^
  a.cc:1:27: note: previous declaration is here
  __declspec(dllimport) int f(int x);
                            ^
  a.cc:1:12: note: previous attribute is here
  __declspec(dllimport) int f(int x);
             ^
  Function is marked as dllimport, but not external.
  i32 (i32)* @"\01?f@@YAHH@Z"
  fatal error: error in backend: Broken function found, compilation aborted!


I think the llvm::Function object has already been created with the dllimport
attribute, before clang sees the definition of f() and drops it from the AST.</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>