[LLVMbugs] [Bug 17592] New: Missing diagnose: declaration of 'T' shadows template parameter

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 15 16:08:00 PDT 2013


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

            Bug ID: 17592
           Summary: Missing diagnose: declaration of 'T' shadows template
                    parameter
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhaoshiz at codeaurora.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu,
                    richard-llvm at metafoo.co.uk
    Classification: Unclassified

Please consider reopen bug-8302

$ cat test.cpp 
template <class T> struct S {
  void foo() {
    void T(void);
  }
};

S<int> s;
void  goo() { s.foo(); }


CLANG:

$ clang++ -target arm-none-linux-gnueabi -mfloat-abi=softfp -mfpu=neon
--sysroot=~/build_tools/gcc-4.6.1-cs/arm-2011.09 test.cpp -c -o test.o

G++:

$ arm-none-linux-gnueabi-g++ -mcpu=cortex-a9 test.cpp -c -o test.o
test.cpp: In member function 'void S<T>::foo()':
test.cpp:3:10: error: declaration of 'void T()'
test.cpp:1:11: error:  shadows template parm 'class T'

Seems to related to commit:

commit dd9459f8869f66409f7ea429053b453e33f6499c
    Author: Richard Smith <richard-llvm at metafoo.co.uk>
    Date:   Tue Aug 13 18:18:50 2013 +0000

        Fix implementation of C11 6.2.7/4 and C++11 [dcl.array]p3:

        When a local extern declaration redeclares some other entity, the type
of that
        entity is merged with the prior type if the prior declaration is
visible (in C)
        or is declared in the same scope (in C++).

         - Make LookupRedeclarationWithLinkage actually work in C++, use it in
the right
           set of cases, and make it track whether it found a shadowed
declaration.
         - Track whether we found a declaration in the same scope (for C++)
including
           across serialization and template instantiation.

        git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188307
91177308-0d34-0410-b5e6-96231b3b80d8

-- 
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/20131015/2b428c85/attachment.html>


More information about the llvm-bugs mailing list