https://bugs.llvm.org/show_bug.cgi?id=40577

            Bug ID: 40577
           Summary: [clang-cl] [ms] Implement warning for shadowing of
                    template parameter extension
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: heavenandhell...@gmail.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to