r274080 - Function declarations are, in fact, permitted in the init-statement of a for
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 28 16:26:18 PDT 2016
Author: rsmith
Date: Tue Jun 28 18:26:18 2016
New Revision: 274080
URL: http://llvm.org/viewvc/llvm-project?rev=274080&view=rev
Log:
Function declarations are, in fact, permitted in the init-statement of a for
loop. Don't confuse Sema by saying they're not.
Modified:
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp
Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=274080&r1=274079&r2=274080&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Tue Jun 28 18:26:18 2016
@@ -2119,9 +2119,9 @@ public:
case FileContext:
case MemberContext:
case BlockContext:
+ case ForContext:
return true;
- case ForContext:
case ConditionContext:
case KNRTypeListContext:
case TypeNameContext:
Modified: cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp?rev=274080&r1=274079&r2=274080&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx1y-deduced-return-type.cpp Tue Jun 28 18:26:18 2016
@@ -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}}
+}
More information about the cfe-commits
mailing list