<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 --- - Weak alias to static function not working"
   href="http://llvm.org/bugs/show_bug.cgi?id=17775">17775</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Weak alias to static function not working
          </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>normal
          </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>scott+llvm+bugzilla@pakin.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=11473" name="attach_11473" title="Minimal reproducer for weak-alias problem">attachment 11473</a> <a href="attachment.cgi?id=11473&action=edit" title="Minimal reproducer for weak-alias problem">[details]</a></span>
Minimal reproducer for weak-alias problem

Weak aliases to unused static functions fail with an error message.  It looks
like the compiler is first removing the unused static function then complaining
that it can't create a weak alias to a function that no longer exists:

$ clang++ --version | head -1
clang version 3.4 (trunk)
$ clang++ -c aliasing.cpp 
aliasing.cpp:8:56: error: alias must point to a defined variable or function
  const char* do_something (void) __attribute__((weak, alias("do_somethi...
                                                       ^
1 error generated.
$ g++ --version | head -1
g++ (GCC) 4.7.2
$ g++ -c aliasing.cpp 

I'm seeing this problem with r193799, but I recall it working in r190315.  This
seems to be a C++ issue; analogous C code made it through clang with no
problems.

Defining do_something_original() as non-static in the attached file makes the
problem go away, but in my real code I'd prefer to have the function declared
static.

-- Scott</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>