[LLVMbugs] [Bug 20249] New: MSVC compatibility hack thwarted by typo correction

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 8 14:22:06 PDT 2014


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

            Bug ID: 20249
           Summary: MSVC compatibility hack thwarted by typo correction
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rnk at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu,
                    richard-llvm at metafoo.co.uk, rikka at google.com
    Classification: Unclassified

Introducing typo correction candidates causes a warning with -fms-compatibility
to become an error.

consider:

$ cat t.cpp
#ifdef BUG
namespace type_in_base_of_dependent_base {
struct A { typedef int NameFromBase; };
}
#endif

namespace function_template_deduction {
// Overloaded function templates.
template <int N> int f() { return N; }
template <typename T> int f() { return sizeof(T); }

// Dependent base class with enum.
template <typename T> struct A { enum { NameFromBase = 4 }; };
template <typename T> struct D : A<T> {
  // expected-warning at +1 {{use of undeclared identifier 'NameFromBase';
unqualified lookup into dependent bases}}
  int x = f<NameFromBase>();
};
}

$ clang -c t.cpp
t.cpp:16:13: warning: use of undeclared identifier 'NameFromBase'; unqualified
lookup into dependent bases of class template 'D' is a Microsoft extension
[-Wmicrosoft]
  int x = f<NameFromBase>();
            ^
            this->
1 warning generated.

$ clang -c t.cpp -DBUG
t.cpp:16:13: error: unknown type name 'NameFromBase'; did you mean
'type_in_base_of_dependent_base::A::NameFromBase'?
  int x = f<NameFromBase>();
            ^~~~~~~~~~~~
            type_in_base_of_dependent_base::A::NameFromBase
t.cpp:3:24: note: 'type_in_base_of_dependent_base::A::NameFromBase' declared
here
struct A { typedef int NameFromBase; };
                       ^
1 error generated.

-- 
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/20140708/75549852/attachment.html>


More information about the llvm-bugs mailing list