]> granicus.if.org Git - clang/commitdiff
Function declarations are, in fact, permitted in the init-statement of a for
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 28 Jun 2016 23:26:18 +0000 (23:26 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 28 Jun 2016 23:26:18 +0000 (23:26 +0000)
loop. Don't confuse Sema by saying they're not.

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

include/clang/Sema/DeclSpec.h
test/SemaCXX/cxx1y-deduced-return-type.cpp

index c71419f28108af4cbbf9a51821c9a2a1dafe90ac..09aabda3805dd58079ee72a16bf608a3e1df215f 100644 (file)
@@ -2119,9 +2119,9 @@ public:
     case FileContext:
     case MemberContext:
     case BlockContext:
+    case ForContext:
       return true;
 
-    case ForContext:
     case ConditionContext:
     case KNRTypeListContext:
     case TypeNameContext:
index e3f6f968017ce2b6735f502f6af1934681b92230..593ec48b4394cdb7af1b6250bf40bcea50170bcb 100644 (file)
@@ -502,3 +502,7 @@ namespace PR24989 {
   using T = decltype(x);
   void (T::*p)(int) const = &T::operator();
 }
+
+void forinit_decltypeauto() {
+  for (decltype(auto) forinit_decltypeauto_inner();;) {} // expected-warning {{interpreted as a function}} expected-note {{replace}}
+}