Patch to accept over-qualified constructor in MSVC emulation mode

Jason Haslam jason.haslam at gmail.com
Wed Feb 6 13:19:28 PST 2013


MSVC accepts this:

class A {
  A::A();
};

Clang accepts regular member functions with extra qualification as an MS extension, but not constructors. The attached patch changes the parser to defer rejecting qualified constructors so that the same Sema logic can apply to constructors as regular member functions. This also improves the error message when MS extensions are disabled (in my opinion). Before it was:

/Users/jason/Desktop/test.cpp:2:8: error: expected member name or ';' after declaration specifiers
  A::A();
  ~~~~ ^
1 error generated.

After:

/Users/jason/Desktop/test.cpp:2:6: error: extra qualification on member 'A'
  A::A();
  ~~~^
1 error generated.

All tests pass and I added one additional test for this case.

Jason

-------------- next part --------------
A non-text attachment was scrubbed...
Name: over-qualified-ctor.diff
Type: application/octet-stream
Size: 2237 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130206/46e0338b/attachment.obj>


More information about the cfe-commits mailing list