[LLVMbugs] [Bug 20733] New: Clang name lookup finds name inappropriately

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 22 12:24:02 PDT 2014


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

            Bug ID: 20733
           Summary: Clang name lookup finds name inappropriately
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hyrosen at mail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

For this code in file g.cpp:

template <class  > struct A              { enum { V }; };
template <int    > struct C              {             };
template <class T> struct S : C<A<T>::V> {             };

void F(const S<void> & = S<void>()) { V; }

clang reports

g.cpp:5:39: warning: expression result unused [-Wunused-value]
void F(const S<void> & = S<void>()) { V; }
                                      ^
1 warning generated.

Obviously there is no bare 'V' that should be visible in F. GCC says

g.cpp: In function 'void F(const S<void>&)':
g.cpp:5:39: error: 'V' was not declared in this scope
 void F(const S<void> & = S<void>()) { V; }
                                       ^

The clang AST says that the 'V' in 'F' is:
DeclRefExpr <col:39> 'enum A<void>::<anonymous at g.cpp:1:44>'
 EnumConstant 'V' 'enum A<void>::<anonymous at g.cpp:1:44>'

-- 
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/20140822/5d21f906/attachment.html>


More information about the llvm-bugs mailing list