<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 --- - infinite loop for clang -cc1 -undef -ast-dump-xml sample.cpp"
   href="http://llvm.org/bugs/show_bug.cgi?id=17493">17493</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>infinite loop for  clang -cc1 -undef -ast-dump-xml  sample.cpp
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>andrey154@gmail.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>Hello

I got following problem out of clang 3.4 (trunk)
While trying to dump xml out of

template <class D>
class scoped_ptr_impl {
  template <typename V> friend class scoped_ptr_impl;
};
scoped_ptr_impl<char> bla;

snippet i got infinite loop of friend template instantiations.
The example is taken from WebKit source code and minimized.

Steps to reproduce:
$ echo "\
<span class="quote">> template <class D> \
> class scoped_ptr_impl { \
>   template <typename V> friend class scoped_ptr_impl; \
> }; \
> scoped_ptr_impl<char> bla; \
> " > sample.cpp</span >
$ clang -cc1 -undef -ast-dump-xml  sample.cpp 2>&1 | tee out.txt
... goes into infinite loop
$ cat out.txt | less
...
 <ClassTemplate ptr="0x4ee6400" name="scoped_ptr_impl">
  <template_parameters>
   <TemplateTypeParm ptr="0x4ee62c0" name="D" typeptr="0x4ee6330" depth="0"
index="0"/>
  </template_parameters>
  <CXXRecord ptr="0x4ee6370" name="scoped_ptr_impl" typeptr="0x4ee65f0">
   <CXXRecord ptr="0x4f1f8d0" name="scoped_ptr_impl" typeptr="0x4ee65f0"/>
   <Friend ptr="0x4f1fb10">
    <ClassTemplate ptr="0x4f1faa0" name="scoped_ptr_impl" previous="0x4ee6400">
     <template_parameters>
      <TemplateTypeParm ptr="0x4f1f960" name="V" typeptr="0x4f1f9d0" depth="1"
index="0"/>
     </template_parameters>
     <CXXRecord ptr="0x4f1fa10" name="scoped_ptr_impl" typeptr="0x4ee65f0"
previous="0x4ee6370"/>
     <instantiation>
      <template_arguments>
       <BuiltinType ptr="0x4ee59a0" canonical="0x4ee59a0"/>
      </template_arguments>
      <ClassTemplateSpecialization ptr="0x4f1fb70" name="scoped_ptr_impl"
typeptr="0x4f1fc50">
       <CXXRecord ptr="0x4f1fde0" name="scoped_ptr_impl" typeptr="0x4f1fc50"
previous="0x4f1fb70"/>
       <Friend ptr="0x4f1fff0">
        <ClassTemplate ptr="0x4f1ff80" name="scoped_ptr_impl"
previous="0x4f1faa0">
         <template_parameters>
          <TemplateTypeParm ptr="0x4f1fe70" name="V" typeptr="0x4f1feb0"
depth="0" index="0"/>
         </template_parameters>
         <CXXRecord ptr="0x4f1fef0" name="scoped_ptr_impl" typeptr="0x4ee65f0"
previous="0x4f1fa10"/>
         <instantiation>
          <template_arguments>
           <BuiltinType ptr="0x4ee59a0" canonical="0x4ee59a0"/>
          </template_arguments>
          <ClassTemplateSpecialization ptr="0x4f1fb70" name="scoped_ptr_impl"
typeptr="0x4f1fc50">
           <CXXRecord ptr="0x4f1fde0" name="scoped_ptr_impl"
typeptr="0x4f1fc50" previous="0x4f1fb70"/>
           <Friend ptr="0x4f1fff0">
...
looping friend template instatntiation...

I will try to fix it. But your help will be appreciated :)
Kind regards,
Andrey Fedorov</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>