Diagnose attempts to use C++ default arguments outside of a function declaration
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50799 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 33797c4..85ff961 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -501,6 +501,10 @@
assert(!T.isNull() && "GetTypeForDeclarator() returned null type");
+ // Check that there are no default arguments (C++ only).
+ if (getLangOptions().CPlusPlus)
+ CheckExtraCXXDefaultArguments(D);
+
// In this context, we *do not* check D.getInvalidType(). If the declarator
// type was invalid, GetTypeForDeclarator() still returns a "valid" type,
// though it will not reflect the user specified type.