[LLVMbugs] [Bug 20591] New: No diagnostic when a template parameter has the same name as the template name

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 8 05:35:59 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20591

            Bug ID: 20591
           Summary: No diagnostic when a template parameter has the same
                    name as the template name
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vvnicholas at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code compiles without any error:


template <int what>
void what(int) {}

int main() {}


It's not well-formed according to § 14.6.1.6:
"A template-parameter shall not be redeclared within its scope (including
nested scopes). _A template-parameter shall not have the same name as the
template name._"

g++ 4.7.2 provides the following diagnostic:

program.cpp:2:6: error: declaration of ‘template<int what> void what(int)’
program.cpp:1:11: error:  shadows template parm ‘int what’

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140808/7068897a/attachment.html>


More information about the llvm-bugs mailing list