<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 - [clang-cl] [ms] Implement warning for shadowing of template parameter extension"
   href="https://bugs.llvm.org/show_bug.cgi?id=40577">40577</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[clang-cl] [ms] Implement warning for shadowing of template parameter extension
          </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>heavenandhell171@gmail.com
          </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>Clang usually warns whenever it compiles non conformant code that MSVC accepts,
which i think it's great. However, there is no warning for shadowing of
template parameters, which is illegal.

For exemple:

$ cat test.cpp
template <typename T>
struct type_t {
  template <typename T>
  void function() {
  }
};

$ clang-cl -c test.cpp

No warning.

I discovered that this is ill-formed when i pushed some code and the GCC build
bot failed. It would be nice to have Clang warn about this extension.

Something like:

$ clang-cl -c test.cpp
test.cpp(3,22):  warning: declaration of 'T' shadows template parameter;
ignored as a Microsoft extension
      [-Wmicrosoft-template]
  template <typename T>
                     ^
test.cpp(1,20):  note: template parameter is declared here
template <typename T>
                   ^
1 warning generated.</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>