<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 --- - enabling debuginfo with -g causes an undefined reference error at link time"
   href="http://llvm.org/bugs/show_bug.cgi?id=19341">19341</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>enabling debuginfo with -g causes an undefined reference error at link time
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>DebugInfo
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>greg_bedwell@sn.scee.net
          </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 testcase below links correctly when built without -g specified, but fails
with undefined reference errors with -g:

$ clang -v
clang version 3.5.0 (205622)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.2
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Candidate multilib: .;@m64
Selected multilib: .;@m64

$ clang 1.cpp

$ clang 1.cpp -g
/tmp/1-812f49.o:(.debug_info+0x91): undefined reference to `Bravo::charlie'
/tmp/1-812f49.o:(.debug_info+0xf2): undefined reference to `alpha()'
clang-3.5: error: linker command failed with exit code 1 (use -v to see
invocation)

// ==========================================
extern char alpha();
struct Bravo {
  static int charlie;
};

template <char (*delta)()> struct Echo {
  int foxtrot() {
    return 1;
  };
};

template <> struct Echo<alpha> {
  int foxtrot() {
    return 100;
  };
};

template <int *delta> struct Golf {
  int foxtrot() {
    return 1000;
  };
};

template <> struct Golf<&Bravo::charlie> {
  int foxtrot() {
    return 10000;
  };
};

int main() {
  Echo<alpha> hotel;
  Golf<&Bravo::charlie> india;
  return hotel.foxtrot() + india.foxtrot();
}
// ==========================================

I've bisected the error and can see that the testcase links successfully at
r181631, but with r181634 it fails with an undefined reference to
'Bravo::charlie'.  At r181685 we also start seeing the undefined reference to
'alpha()'.

Here are the relevant revisions:

-----------------------------------------------
<a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=181632">http://llvm.org/viewvc/llvm-project?view=revision&revision=181632</a>
PR14492: Debug Info: Support for values of non-integer non-type template
parameters.

This is only tested for global variables at the moment (& includes tests
for the unnamed parameter case, since apparently this entire function
was completely untested previously)
-----------------------------------------------

-----------------------------------------------
<a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=181634">http://llvm.org/viewvc/llvm-project?view=revision&revision=181634</a>
PR14992: Debug Info: Support more non-type template parameters

* Provide DW_TAG_template_value_parameter for pointers, function
  pointers, member pointers, and member function pointers (still missing
  support for template template parameters which GCC encodes as a
  DW_TAG_GNU_template_template_param)
* Provide values for all but the (member & non-member) function pointer case.
  Simple constant integer values for member pointers (offset within the
  object) and address for the value pointer case. GCC doesn't provide a
  value for the member function pointer case so I'm not sure how, if at
  all, GDB supports encoding that. & non-member function pointers should
  follow shortly in a subsequent patch.
* Null pointer value encodings of all of these types, including
  correctly encoding null data member pointers as -1.
-----------------------------------------------

-----------------------------------------------
<a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=181685">http://llvm.org/viewvc/llvm-project?view=revision&revision=181685</a>
Debug Info: PR14992: Support values for non-type template parameters of
function type
-----------------------------------------------</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>