[PATCH] Allow lookup into dependent bases in static methods under -fms-compatibility

Reid Kleckner rnk at google.com
Mon Jun 9 17:28:30 PDT 2014


Hi rsmith,

We currently allow unqualified lookup for instance methods but not
static methods because we can't recover with a semantic 'this->'
insertion.

ATL headers have static methods that do unqualified lookup into
dependent base classes.  The pattern looks like:

  template <typename T> struct Foo : T {
    static int *getBarFromT() { return Bar; }
  };

Now we recover as if the user had written:

  template <typename T> struct Foo : T {
    static int *getBarFromT() { return Foo::Bar; }
  };

... which will eventually look up Bar in T at instantiation time.

Now we also emit a diagnostic in both cases.

http://reviews.llvm.org/D4079

Files:
  lib/Sema/SemaExpr.cpp
  test/SemaTemplate/ms-lookup-template-base-classes.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4079.10255.patch
Type: text/x-patch
Size: 6709 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140610/b7311678/attachment.bin>


More information about the cfe-commits mailing list