]> granicus.if.org Git - clang/commitdiff
PR13433: In Microsoft mode, don't require function calls within decltype
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 28 Jul 2012 19:54:11 +0000 (19:54 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 28 Jul 2012 19:54:11 +0000 (19:54 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160924 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExprCXX.cpp
test/SemaCXX/microsoft-cxx0x.cpp

index 278549b4b7d6bc608e5db2c3fb31111e5f47d584..b47bd970d055d6c7bbedbf05031ec70aed857d45 100644 (file)
@@ -4783,6 +4783,11 @@ ExprResult Sema::ActOnDecltypeExpression(Expr *E) {
   // 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) {
index 3b9bbefc0cd6b1df896bd1cb2e5499e2fe750bf1..79bd7c39e5a542ef0fcf00584a73731ffea0ca1a 100644 (file)
@@ -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 @@ struct A {
 };
 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@-2{{calling 'make' with incomplete return type 'PR13433::S'}}
+// expected-note@-5{{'make' declared here}}
+// expected-note@-7{{forward declaration of 'PR13433::S'}}
+#endif
+}