[cfe-commits] r160924 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/SemaCXX/microsoft-cxx0x.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Sat Jul 28 12:54:11 PDT 2012
Author: rsmith
Date: Sat Jul 28 14:54:11 2012
New Revision: 160924
URL: http://llvm.org/viewvc/llvm-project?rev=160924&view=rev
Log:
PR13433: In Microsoft mode, don't require function calls within decltype
expressions to have complete return types (or accessible destructors). If the
return type is required to be complete for some other reason (for instance, if
it is needed by overload resolution), then it will still be required to be
complete. This is apparently required in order to parse a MSVC11 header.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/microsoft-cxx0x.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=160924&r1=160923&r2=160924&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sat Jul 28 14:54:11 2012
@@ -4783,6 +4783,11 @@
// Disable the special decltype handling now.
Rec.IsDecltype = false;
+ // In MS mode, don't perform any extra checking of call return types within a
+ // decltype expression.
+ if (getLangOpts().MicrosoftMode)
+ return Owned(E);
+
// Perform the semantic checks we delayed until this point.
CallExpr *TopCall = dyn_cast<CallExpr>(E);
for (unsigned I = 0, N = Rec.DelayedDecltypeCalls.size(); I != N; ++I) {
Modified: cfe/trunk/test/SemaCXX/microsoft-cxx0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/microsoft-cxx0x.cpp?rev=160924&r1=160923&r2=160924&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/microsoft-cxx0x.cpp (original)
+++ cfe/trunk/test/SemaCXX/microsoft-cxx0x.cpp Sat Jul 28 14:54:11 2012
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wc++11-narrowing -Wmicrosoft -verify -fms-extensions -std=c++11
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wc++11-narrowing -Wmicrosoft -verify -fms-extensions -std=c++11 -fms-compatibility -DMS_COMPAT
struct A {
@@ -6,3 +7,16 @@
};
int b = 3;
A var = { b }; // expected-warning {{ cannot be narrowed }} expected-note {{override}}
+
+
+namespace PR13433 {
+ struct S;
+ S make();
+
+ template<typename F> auto x(F f) -> decltype(f(make()));
+#ifndef MS_COMPAT
+// expected-error at -2{{calling 'make' with incomplete return type 'PR13433::S'}}
+// expected-note at -5{{'make' declared here}}
+// expected-note at -7{{forward declaration of 'PR13433::S'}}
+#endif
+}
More information about the cfe-commits
mailing list