<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 --- - [TableGen] Default template argument does not have the same behavior as passing the same argument explicitly"
   href="http://llvm.org/bugs/show_bug.cgi?id=18676">18676</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[TableGen] Default template argument does not have the same behavior as passing the same argument explicitly
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>qcolombet@apple.com
          </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>Created <span class=""><a href="attachment.cgi?id=11980" name="attach_11980" title="File to reproduce the error">attachment 11980</a> <a href="attachment.cgi?id=11980&action=edit" title="File to reproduce the error">[details]</a></span>
File to reproduce the error

I have attached two td files:
- ko.td uses the default initializer of an argument of a template.
- ok.td specifies the same argument via an explicit value (which is the same as
the default one).

llvm-tblgen <ok|ko>.td -gen-subtarget -I <llvmsrc>/include/

* RESULTS
ko.td:
ko.td:44:1: error: Record `Testrm', field `SchedRW' list is not entirely
DefInit!
defm Test : SS48I_binop_rm;
^
ko.td:40:3: note: instantiated from multiclass
def rm : Instruction, Sched<[itins.Sched.Folded]>;

ok.td:
Works!

The only difference between ok.td and ko.td is:
$ diff ok.td ko.td
44c44
< defm Test : SS48I_binop_rm<SSE_ALU_F32S>;
---
<span class="quote">> defm Test : SS48I_binop_rm;</span >

I would expect both files to produce the same output since SS48I_binop_rm
specifies the default argument like this:
multiclass SS48I_binop_rm<OpndItins itins = SSE_ALU_F32S> {

* NOTES
If I replace itins.Sched.Folded by itins.Sched (i.e., one less indirection), it
works for ko.td too.</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>