<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 - Function emitted only with -g, not emitted without"
   href="https://bugs.llvm.org/show_bug.cgi?id=49700">49700</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Function emitted only with -g, not emitted without
          </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>Windows NT
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>russell_gallop@sn.scee.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Derived from <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - The order of function differs with or w/o -g"
   href="show_bug.cgi?id=49691">bug 49691</a>.

With this example b() is emitted with -g enabled and not emitted without.

$ clang++ --version
clang version 13.0.0 (75e8f225e9f2fd3758ed1c8e32bf2a70f584a8e5)
...

$ cat re.cpp
template <bool()> class a {};
static bool b() { return false;}
struct B {
  B();
  a<b> c;
};
B::B() {}

$ cat test.sh
#!/bin/bash -e
SOURCE=${1:-re.cpp}
CXX=~/git/llvm-project/stage1/bin/clang++
${CXX} -c ${SOURCE} -o dbg.o -g
objdump -t dbg.o | grep "\.text" > dbg.od
${CXX} -c ${SOURCE} -o rel.o
objdump -t rel.o | grep "\.text" > rel.od
! diff dbg.od rel.od

$ ./test.sh
2d1
< 0000000000000010 l     F .text        000000000000000d _ZL1bv</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>