<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:rnk@google.com" title="Reid Kleckner <rnk@google.com>"> <span class="fn">Reid Kleckner</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WONTFIX - __attribute__((optnone)) not respected for included lambda"
   href="https://bugs.llvm.org/show_bug.cgi?id=41343">bug 41343</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>rnk@google.com
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>WONTFIX
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WONTFIX - __attribute__((optnone)) not respected for included lambda"
   href="https://bugs.llvm.org/show_bug.cgi?id=41343#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WONTFIX - __attribute__((optnone)) not respected for included lambda"
   href="https://bugs.llvm.org/show_bug.cgi?id=41343">bug 41343</a>
              from <span class="vcard"><a class="email" href="mailto:rnk@google.com" title="Reid Kleckner <rnk@google.com>"> <span class="fn">Reid Kleckner</span></a>
</span></b>
        <pre>We already have a different facility for disabling optimizations over a region
of code (#pragma clang optimize off/on):
<a href="https://bcain-llvm.readthedocs.io/projects/clang/en/latest/LanguageExtensions/#extensions-for-selectively-disabling-optimization">https://bcain-llvm.readthedocs.io/projects/clang/en/latest/LanguageExtensions/#extensions-for-selectively-disabling-optimization</a>

You can also explicitly mark the lambda optnone if you like:
template <typename T> void Test<T>::init() {
  [&]() __attribute__((optnone)) { this->template doThis<int>(); }();
  this->template doThat<int>();
};
That seems to work for me.

It's possible that my brain has been broken by working too long on compilers,
because our current behavior seems quite logical to me. I quizzed my coworkers,
and the consensus was that it's probably not worth the effort and code
complexity to change how we look for this specific attribute. There are two
other existing ways to get the behavior you want, so I don't think it's likely
that we will make this change.</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>