[LLVMbugs] [Bug 12701] New: Support unqualified base lookup in microsoft mode in template functions of template classes

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Apr 29 22:19:44 PDT 2012


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

             Bug #: 12701
           Summary: Support unqualified base lookup in microsoft mode in
                    template functions of template classes
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nicolasweber at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


cl.exe accepts this program. clang doesn't:

class A {};
class B {};

template <class T>
class Base {
 public:
  bool base_fun(void* p) { return false; }
  operator T*() const { return 0; }
};

template <class T>
class Container : public Base<T> {
 public:
  template <typename S>
  bool operator=(const Container<S>& rhs) {
    return base_fun(rhs);
  }
};

void f() {
  Container<A> text_provider;
  Container<B> text_provider2;
  text_provider2 = text_provider;
}


C:\src\chrome\src>cl /c test.cc
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

test.cc

C:\src\chrome\src>..\..\llvm-build\bin\Release\clang.exe -c test.cc
test.cc:16:12: error: use of undeclared identifier 'base_fun'
    return base_fun(rhs);
           ^
test.cc:23:18: note: in instantiation of function template specialization
'Container<B>::operator=<A>' requested here
  text_provider2 = text_provider;
                 ^
test.cc:7:8: note: must qualify identifier to find this declaration in
dependent base class
  bool base_fun(void* p) { return false; }
       ^
1 error generated.



It looks like the function that prints this is Sema::DiagnoseEmptyLookup in
SemaExpr.cpp. It looks like it permits similar constructs in other places in
microsoft mode already.

This is necessary to parse atlcomcli.h

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list