Merge remote-tracking branch 'origin/swift-4.1-branch' into stable
diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td
index d75a302..9387ed2 100644
--- a/include/clang/Basic/DiagnosticGroups.td
+++ b/include/clang/Basic/DiagnosticGroups.td
@@ -155,9 +155,10 @@
 
 def InvalidIOSDeploymentTarget : DiagGroup<"invalid-ios-deployment-target">;
 
-def CXX1zCompatMangling : DiagGroup<"c++1z-compat-mangling">;
+def CXX17CompatMangling : DiagGroup<"c++17-compat-mangling">;
+def : DiagGroup<"c++1z-compat-mangling", [CXX17CompatMangling]>;
 // Name of this warning in GCC.
-def NoexceptType : DiagGroup<"noexcept-type", [CXX1zCompatMangling]>;
+def NoexceptType : DiagGroup<"noexcept-type", [CXX17CompatMangling]>;
 
 // Warnings for C++1y code which is not compatible with prior C++ standards.
 def CXXPre14Compat : DiagGroup<"c++98-c++11-compat">;
@@ -219,9 +220,10 @@
 def CXX14CompatPedantic : DiagGroup<"c++14-compat-pedantic",
                                     [CXXPre1zCompatPedantic]>;
 
-def CXX1zCompat : DiagGroup<"c++1z-compat", [DeprecatedRegister,
+def CXX17Compat : DiagGroup<"c++17-compat", [DeprecatedRegister,
                                              DeprecatedIncrementBool,
-                                             CXX1zCompatMangling]>;
+                                             CXX17CompatMangling]>;
+def : DiagGroup<"c++1z-compat", [CXX17Compat]>;
 
 def ExitTimeDestructors : DiagGroup<"exit-time-destructors">;
 def FlexibleArrayExtensions : DiagGroup<"flexible-array-extensions">;
@@ -777,10 +779,11 @@
 
 // A warning group for warnings about using C++1z features as extensions in
 // earlier C++ versions.
-def CXX1z : DiagGroup<"c++1z-extensions">;
+def CXX17 : DiagGroup<"c++17-extensions">;
 
 def : DiagGroup<"c++0x-extensions", [CXX11]>;
 def : DiagGroup<"c++1y-extensions", [CXX14]>;
+def : DiagGroup<"c++1z-extensions", [CXX17]>;
 
 def DelegatingCtorCycles :
   DiagGroup<"delegating-ctor-cycles">;
diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td
index d6de5c0..706881b 100644
--- a/include/clang/Basic/DiagnosticLexKinds.td
+++ b/include/clang/Basic/DiagnosticLexKinds.td
@@ -181,10 +181,10 @@
 def ext_hex_constant_invalid : Extension<
   "hexadecimal floating constants are a C99 feature">, InGroup<C99>;
 def ext_hex_literal_invalid : Extension<
-  "hexadecimal floating literals are a C++1z feature">, InGroup<CXX1z>;
+  "hexadecimal floating literals are a C++17 feature">, InGroup<CXX17>;
 def warn_cxx1z_hex_literal : Warning<
   "hexadecimal floating literals are incompatible with "
-  "C++ standards before C++1z">,
+  "C++ standards before C++17">,
   InGroup<CXXPre1zCompatPedantic>, DefaultIgnore;
 def ext_binary_literal : Extension<
   "binary integer literals are a GNU extension">, InGroup<GNUBinaryLiteral>;
@@ -208,7 +208,7 @@
   "unicode literals are incompatible with C++98">,
   InGroup<CXX98Compat>, DefaultIgnore;
 def warn_cxx14_compat_u8_character_literal : Warning<
-  "unicode literals are incompatible with C++ standards before C++1z">,
+  "unicode literals are incompatible with C++ standards before C++17">,
   InGroup<CXXPre1zCompat>, DefaultIgnore;
 def warn_cxx11_compat_user_defined_literal : Warning<
   "identifier after literal will be treated as a user-defined literal suffix "
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index f9325c7..193a31a 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -211,10 +211,10 @@
 def err_namespace_nonnamespace_scope : Error<
   "namespaces can only be defined in global or namespace scope">;
 def ext_nested_namespace_definition : ExtWarn<
-  "nested namespace definition is a C++1z extension; "
-  "define each namespace separately">, InGroup<CXX1z>;
+  "nested namespace definition is a C++17 extension; "
+  "define each namespace separately">, InGroup<CXX17>;
 def warn_cxx14_compat_nested_namespace_definition : Warning<
-  "nested namespace definition is incompatible with C++ standards before C++1z">,
+  "nested namespace definition is incompatible with C++ standards before C++17">,
   InGroup<CXXPre1zCompat>, DefaultIgnore;
 def err_inline_nested_namespace_definition : Error<
   "nested namespace definition cannot be 'inline'">;
@@ -358,7 +358,7 @@
   "expected '::' after '__super'">;
 
 def ext_decomp_decl_empty : ExtWarn<
-  "ISO C++1z does not allow a decomposition group to be empty">,
+  "ISO C++17 does not allow a decomposition group to be empty">,
   InGroup<DiagGroup<"empty-decomposition">>;
 
 /// Objective-C parser diagnostics
@@ -522,16 +522,16 @@
 def err_super_in_using_declaration : Error<
   "'__super' cannot be used with a using declaration">;
 def ext_constexpr_if : ExtWarn<
-  "constexpr if is a C++1z extension">, InGroup<CXX1z>;
+  "constexpr if is a C++17 extension">, InGroup<CXX17>;
 def warn_cxx14_compat_constexpr_if : Warning<
-  "constexpr if is incompatible with C++ standards before C++1z">,
+  "constexpr if is incompatible with C++ standards before C++17">,
   DefaultIgnore, InGroup<CXXPre1zCompat>;
 def ext_init_statement : ExtWarn<
-  "'%select{if|switch}0' initialization statements are a C++1z extension">,
-  InGroup<CXX1z>;
+  "'%select{if|switch}0' initialization statements are a C++17 extension">,
+  InGroup<CXX17>;
 def warn_cxx14_compat_init_statement : Warning<
   "%select{if|switch}0 initialization statements are incompatible with "
-  "C++ standards before C++1z">, DefaultIgnore, InGroup<CXXPre1zCompat>;
+  "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre1zCompat>;
 
 // C++ derived classes
 def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">;
@@ -560,7 +560,7 @@
 
 def warn_cxx14_compat_attribute : Warning<
   "attributes on %select{a namespace|an enumerator}0 declaration are "
-  "incompatible with C++ standards before C++1z">,
+  "incompatible with C++ standards before C++17">,
   InGroup<CXXPre1zCompat>, DefaultIgnore;
 def warn_cxx98_compat_alignas : Warning<"'alignas' is incompatible with C++98">,
   InGroup<CXX98Compat>, DefaultIgnore;
@@ -577,10 +577,10 @@
   "attribute %0 cannot appear multiple times in an attribute specifier">;
 def warn_cxx14_compat_using_attribute_ns : Warning<
   "default scope specifier for attributes is incompatible with C++ standards "
-  "before C++1z">, InGroup<CXXPre1zCompat>, DefaultIgnore;
+  "before C++17">, InGroup<CXXPre1zCompat>, DefaultIgnore;
 def ext_using_attribute_ns : ExtWarn<
-  "default scope specifier for attributes is a C++1z extension">,
-  InGroup<CXX1z>;
+  "default scope specifier for attributes is a C++17 extension">,
+  InGroup<CXX17>;
 def err_using_attribute_ns_conflict : Error<
   "attribute with scope specifier cannot follow default scope specifier">;
 def err_attributes_not_allowed : Error<"an attribute list cannot appear here">;
@@ -617,11 +617,11 @@
 def err_class_on_template_template_param : Error<
   "template template parameter requires 'class' after the parameter list">;
 def ext_template_template_param_typename : ExtWarn<
-  "template template parameter using 'typename' is a C++1z extension">,
-  InGroup<CXX1z>;
+  "template template parameter using 'typename' is a C++17 extension">,
+  InGroup<CXX17>;
 def warn_cxx14_compat_template_template_param_typename : Warning<
   "template template parameter using 'typename' is "
-  "incompatible with C++ standards before C++1z">,
+  "incompatible with C++ standards before C++17">,
   InGroup<CXXPre1zCompat>, DefaultIgnore;
 def err_template_spec_syntax_non_template : Error<
   "identifier followed by '<' indicates a class template specialization but "
@@ -695,10 +695,10 @@
   "template">;
 
 def ext_fold_expression : ExtWarn<
-  "pack fold expression is a C++1z extension">,
-  InGroup<CXX1z>;
+  "pack fold expression is a C++17 extension">,
+  InGroup<CXX17>;
 def warn_cxx14_compat_fold_expression : Warning<
-  "pack fold expression is incompatible with C++ standards before C++1z">,
+  "pack fold expression is incompatible with C++ standards before C++17">,
   InGroup<CXXPre1zCompat>, DefaultIgnore;
 def err_expected_fold_operator : Error<
   "expected a foldable binary operator in fold expression">;
@@ -751,16 +751,16 @@
 // C++1z using-declaration pack expansions
 def ext_multi_using_declaration : ExtWarn<
   "use of multiple declarators in a single using declaration is "
-  "a C++1z extension">, InGroup<CXX1z>;
+  "a C++17 extension">, InGroup<CXX17>;
 def warn_cxx1z_compat_multi_using_declaration : Warning<
   "use of multiple declarators in a single using declaration is "
-  "incompatible with C++ standards before C++1z">,
+  "incompatible with C++ standards before C++17">,
   InGroup<CXXPre1zCompat>, DefaultIgnore;
 def ext_using_declaration_pack : ExtWarn<
-  "pack expansion of using declaration is a C++1z extension">, InGroup<CXX1z>;
+  "pack expansion of using declaration is a C++17 extension">, InGroup<CXX17>;
 def warn_cxx1z_compat_using_declaration_pack : Warning<
   "pack expansion using declaration is incompatible with C++ standards "
-  "before C++1z">, InGroup<CXXPre1zCompat>, DefaultIgnore;
+  "before C++17">, InGroup<CXXPre1zCompat>, DefaultIgnore;
 
 // C++11 override control
 def ext_override_control_keyword : ExtWarn<
@@ -817,10 +817,10 @@
 
 // C++1z constexpr lambda expressions
 def warn_cxx14_compat_constexpr_on_lambda : Warning<
-  "constexpr on lambda expressions is incompatible with C++ standards before C++1z">,
+  "constexpr on lambda expressions is incompatible with C++ standards before C++17">,
   InGroup<CXXPre1zCompat>, DefaultIgnore;
 def ext_constexpr_on_lambda_cxx1z : ExtWarn<
-  "'constexpr' on lambda expressions is a C++1z extension">, InGroup<CXX1z>;
+  "'constexpr' on lambda expressions is a C++17 extension">, InGroup<CXX17>;
 
 // Availability attribute
 def err_expected_version : Error<
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index b1ad33e..fd992e7 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -211,9 +211,9 @@
 
 def warn_deprecated_register : Warning<
   "'register' storage class specifier is deprecated "
-  "and incompatible with C++1z">, InGroup<DeprecatedRegister>;
+  "and incompatible with C++17">, InGroup<DeprecatedRegister>;
 def ext_register_storage_class : ExtWarn<
-  "ISO C++1z does not allow 'register' storage class specifier">,
+  "ISO C++17 does not allow 'register' storage class specifier">,
   DefaultError, InGroup<Register>;
 
 def err_invalid_decl_spec_combination : Error<
@@ -391,9 +391,9 @@
   "decomposition declaration not permitted in this context">;
 def warn_cxx14_compat_decomp_decl : Warning<
   "decomposition declarations are incompatible with "
-  "C++ standards before C++1z">, DefaultIgnore, InGroup<CXXPre1zCompat>;
+  "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre1zCompat>;
 def ext_decomp_decl : ExtWarn<
-  "decomposition declarations are a C++1z extension">, InGroup<CXX1z>;
+  "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
 def err_decomp_decl_spec : Error<
   "decomposition declaration cannot be declared "
   "%plural{1:'%1'|:with '%1' specifiers}0">;
@@ -494,7 +494,7 @@
   "ISO C++11 does not allow access declarations; "
   "use using declarations instead">;
 def ext_dynamic_exception_spec : ExtWarn<
-  "ISO C++1z does not allow dynamic exception specifications">,
+  "ISO C++17 does not allow dynamic exception specifications">,
   InGroup<DynamicExceptionSpec>, DefaultError;
 def warn_exception_spec_deprecated : Warning<
   "dynamic exception specifications are deprecated">,
@@ -507,7 +507,7 @@
   InGroup<Deprecated>, DefaultIgnore;
 def warn_cxx1z_compat_exception_spec_in_signature : Warning<
   "mangled name of %0 will change in C++17 due to non-throwing exception "
-  "specification in function signature">, InGroup<CXX1zCompatMangling>;
+  "specification in function signature">, InGroup<CXX17CompatMangling>;
 
 def warn_global_constructor : Warning<
   "declaration requires a global constructor">,
@@ -1206,15 +1206,15 @@
   "static_assert expression is not an integral constant expression">;
 def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">;
 def ext_static_assert_no_message : ExtWarn<
-  "static_assert with no message is a C++1z extension">, InGroup<CXX1z>;
+  "static_assert with no message is a C++17 extension">, InGroup<CXX17>;
 def warn_cxx14_compat_static_assert_no_message : Warning<
-  "static_assert with no message is incompatible with C++ standards before C++1z">,
+  "static_assert with no message is incompatible with C++ standards before C++17">,
   DefaultIgnore, InGroup<CXXPre1zCompat>;
 
 def ext_inline_variable : ExtWarn<
-  "inline variables are a C++1z extension">, InGroup<CXX1z>;
+  "inline variables are a C++17 extension">, InGroup<CXX17>;
 def warn_cxx14_compat_inline_variable : Warning<
-  "inline variables are incompatible with C++ standards before C++1z">,
+  "inline variables are incompatible with C++ standards before C++17">,
   DefaultIgnore, InGroup<CXXPre1zCompat>;
 
 def warn_inline_namespace_reopened_noninline : Warning<
@@ -1928,7 +1928,7 @@
   "|in non-static struct member|in struct member"
   "|in non-static union member|in union member"
   "|in non-static class member|in interface member"
-  "|in exception declaration|in template parameter until C++1z|in block literal"
+  "|in exception declaration|in template parameter until C++17|in block literal"
   "|in template argument|in typedef|in type alias|in function return type"
   "|in conversion function type|here|in lambda parameter"
   "|in type allocated by 'new'|in K&R-style function parameter"
@@ -2153,11 +2153,11 @@
 def err_for_range_member_begin_end_mismatch : Error<
   "range type %0 has '%select{begin|end}1' member but no '%select{end|begin}1' member">;
 def ext_for_range_begin_end_types_differ : ExtWarn<
-  "'begin' and 'end' returning different types (%0 and %1) is a C++1z extension">,
-  InGroup<CXX1z>;
+  "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">,
+  InGroup<CXX17>;
 def warn_for_range_begin_end_types_differ : Warning<
   "'begin' and 'end' returning different types (%0 and %1) is incompatible "
-  "with C++ standards before C++1z">, InGroup<CXXPre1zCompat>, DefaultIgnore;
+  "with C++ standards before C++17">, InGroup<CXXPre1zCompat>, DefaultIgnore;
 def note_in_for_range: Note<
   "when looking up '%select{begin|end}0' function for range expression "
   "of type %1">;
@@ -3979,7 +3979,7 @@
   "a non-type template parameter cannot have type %0">;
 def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
   "non-type template parameters declared with %0 are incompatible with C++ "
-  "standards before C++1z">,
+  "standards before C++17">,
   DefaultIgnore, InGroup<CXXPre1zCompat>;
 def err_template_param_default_arg_redefinition : Error<
   "template parameter redefines default argument">;
@@ -6411,9 +6411,9 @@
 def err_decrement_bool : Error<"cannot decrement expression of type bool">;
 def warn_increment_bool : Warning<
   "incrementing expression of type bool is deprecated and "
-  "incompatible with C++1z">, InGroup<DeprecatedIncrementBool>;
+  "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
 def ext_increment_bool : ExtWarn<
-  "ISO C++1z does not allow incrementing expression of type bool">,
+  "ISO C++17 does not allow incrementing expression of type bool">,
   DefaultError, InGroup<IncrementBool>;
 def err_increment_decrement_enum : Error<
   "cannot %select{decrement|increment}0 expression of enum type %1">;
@@ -6602,10 +6602,10 @@
 
   // C++1z '*this' captures.
   def warn_cxx14_compat_star_this_lambda_capture : Warning<
-    "by value capture of '*this' is incompatible with C++ standards before C++1z">,
+    "by value capture of '*this' is incompatible with C++ standards before C++17">,
      InGroup<CXXPre1zCompat>, DefaultIgnore;
   def ext_star_this_lambda_capture_cxx1z : ExtWarn<
-    "capture of '*this' by copy is a C++1z extension">, InGroup<CXX1z>;
+    "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
 }
 
 def err_return_in_captured_stmt : Error<
@@ -7274,7 +7274,7 @@
 def ext_cxx14_attr : Extension<
   "use of the %0 attribute is a C++14 extension">, InGroup<CXX14>;
 def ext_cxx1z_attr : Extension<
-  "use of the %0 attribute is a C++1z extension">, InGroup<CXX1z>;
+  "use of the %0 attribute is a C++17 extension">, InGroup<CXX17>;
 
 def warn_unused_comparison : Warning<
   "%select{%select{|in}1equality|relational}0 comparison result unused">,
diff --git a/include/clang/Frontend/LangStandards.def b/include/clang/Frontend/LangStandards.def
index 669e487..a019d63 100644
--- a/include/clang/Frontend/LangStandards.def
+++ b/include/clang/Frontend/LangStandards.def
@@ -109,15 +109,17 @@
              GNUMode)
 LANGSTANDARD_ALIAS_DEPR(gnucxx14, "gnu++1y")
 
-LANGSTANDARD(cxx1z, "c++1z",
-             CXX, "Working draft for ISO C++ 2017",
+LANGSTANDARD(cxx17, "c++17",
+             CXX, "ISO C++ 2017 with amendments",
              LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus1z |
              Digraphs | HexFloat)
+LANGSTANDARD_ALIAS_DEPR(cxx17, "c++1z")
 
-LANGSTANDARD(gnucxx1z, "gnu++1z",
-             CXX, "Working draft for ISO C++ 2017 with GNU extensions",
+LANGSTANDARD(gnucxx17, "gnu++17",
+             CXX, "ISO C++ 2017 with amendments and GNU extensions",
              LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus1z |
              Digraphs | HexFloat | GNUMode)
+LANGSTANDARD_ALIAS_DEPR(gnucxx17, "gnu++1z")
 
 LANGSTANDARD(cxx2a, "c++2a",
              CXX, "Working draft for ISO C++ 2020",
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 29ea2e6..b76ef4f 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -13309,6 +13309,7 @@
         AddMsStructLayoutForRecord(RD);
       }
     }
+    New->setLexicalDeclContext(CurContext);
     return New;
   };
 
diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp
index 3d4b925..072f5e7 100644
--- a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp
+++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++1z -verify -Wc++1z-extensions %s
-// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -DEXT -Wc++1z-extensions %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify -Wc++17-extensions %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify -DEXT -Wc++17-extensions %s
 
 struct [[nodiscard]] S {};
 S get_s();
@@ -23,7 +23,7 @@
 }
 
 #ifdef EXT
-// expected-warning@4 {{use of the 'nodiscard' attribute is a C++1z extension}}
-// expected-warning@8 {{use of the 'nodiscard' attribute is a C++1z extension}}
-// expected-warning@11 {{use of the 'nodiscard' attribute is a C++1z extension}}
+// expected-warning@4 {{use of the 'nodiscard' attribute is a C++17 extension}}
+// expected-warning@8 {{use of the 'nodiscard' attribute is a C++17 extension}}
+// expected-warning@11 {{use of the 'nodiscard' attribute is a C++17 extension}}
 #endif
diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp
index a627d83..551df38 100644
--- a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp
+++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.unused/p3.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++1z -Wc++1z-extensions -verify %s
-// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++11 -Wc++1z-extensions -verify -DEXT %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++17 -Wc++17-extensions -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused -Wused-but-marked-unused -std=c++11 -Wc++17-extensions -verify -DEXT %s
 
 static_assert(__has_cpp_attribute(maybe_unused) == 201603, "");
 
@@ -20,7 +20,7 @@
 }
 
 #ifdef EXT
-// expected-warning@6 {{use of the 'maybe_unused' attribute is a C++1z extension}}
-// expected-warning@13 {{use of the 'maybe_unused' attribute is a C++1z extension}}
-// expected-warning@14 {{use of the 'maybe_unused' attribute is a C++1z extension}}
+// expected-warning@6 {{use of the 'maybe_unused' attribute is a C++17 extension}}
+// expected-warning@13 {{use of the 'maybe_unused' attribute is a C++17 extension}}
+// expected-warning@14 {{use of the 'maybe_unused' attribute is a C++17 extension}}
 #endif
diff --git a/test/CXX/drs/dr0xx.cpp b/test/CXX/drs/dr0xx.cpp
index 055f40f..fbca663 100644
--- a/test/CXX/drs/dr0xx.cpp
+++ b/test/CXX/drs/dr0xx.cpp
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -Wno-bind-to-temporary-copy
 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
-// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
+// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple
 
 namespace dr1 { // dr1: no
   namespace X { extern "C" void dr1_f(int a = 1); }
@@ -276,9 +276,9 @@
 
 namespace dr25 { // dr25: yes
   struct A {
-    void f() throw(int); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}}
+    void f() throw(int); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}}
   };
-  void (A::*f)() throw (int); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}}
+  void (A::*f)() throw (int); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}}
   void (A::*g)() throw () = f;
 #if __cplusplus <= 201402L
   // expected-error@-2 {{is not superset of source}}
@@ -286,7 +286,7 @@
   // expected-error@-4 {{different exception specifications}}
 #endif
   void (A::*g2)() throw () = 0;
-  void (A::*h)() throw (int, char) = f; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}}
+  void (A::*h)() throw (int, char) = f; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}}
   void (A::*i)() throw () = &A::f;
 #if __cplusplus <= 201402L
   // expected-error@-2 {{is not superset of source}}
@@ -294,7 +294,7 @@
   // expected-error@-4 {{different exception specifications}}
 #endif
   void (A::*i2)() throw () = 0;
-  void (A::*j)() throw (int, char) = &A::f; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}}
+  void (A::*j)() throw (int, char) = &A::f; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}}
   void x() {
     g2 = f;
 #if __cplusplus <= 201402L
@@ -941,7 +941,7 @@
   };
   A a;
   // Cannot use B(C) / operator C() pair to construct the B from the B temporary
-  // here. In C++1z, we initialize the B object directly using 'A::operator B()'.
+  // here. In C++17, we initialize the B object directly using 'A::operator B()'.
   B b = a;
 #if __cplusplus <= 201402L
   // expected-error@-2 {{no viable}}
@@ -1033,14 +1033,14 @@
 }
 
 namespace dr92 { // dr92: 4 c++17
-  void f() throw(int, float); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}}
-  void (*p)() throw(int) = &f; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}}
+  void f() throw(int, float); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}}
+  void (*p)() throw(int) = &f; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}}
 #if __cplusplus <= 201402L
   // expected-error@-2 {{target exception specification is not superset of source}}
 #else
   // expected-warning@-4 {{target exception specification is not superset of source}}
 #endif
-  void (*q)() throw(int); // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}}
+  void (*q)() throw(int); // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}}
   void (**pp)() throw() = &q;
 #if __cplusplus <= 201402L
   // expected-error@-2 {{exception specifications are not allowed}}
@@ -1064,7 +1064,7 @@
   // expected-error@-2 {{not implicitly convertible}}
 #endif
 
-  template<void() throw(int)> struct Y {}; // expected-error 0-1{{ISO C++1z does not allow}} expected-note 0-1{{use 'noexcept}}
+  template<void() throw(int)> struct Y {}; // expected-error 0-1{{ISO C++17 does not allow}} expected-note 0-1{{use 'noexcept}}
   Y<&h> yp; // ok
 }
 
diff --git a/test/CXX/drs/dr13xx.cpp b/test/CXX/drs/dr13xx.cpp
index 64ba3be..f193c8e 100644
--- a/test/CXX/drs/dr13xx.cpp
+++ b/test/CXX/drs/dr13xx.cpp
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
 __extension__ typedef __SIZE_TYPE__ size_t;
 
@@ -124,7 +124,7 @@
 namespace dr1330 { // dr1330: 4 c++11
   // exception-specifications are parsed in a context where the class is complete.
   struct A {
-    void f() throw(T) {} // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}}
+    void f() throw(T) {} // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}}
     struct T {};
 
 #if __cplusplus >= 201103L
@@ -134,7 +134,7 @@
 #endif
   };
 
-  void (A::*af1)() throw(A::T) = &A::f; // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}}
+  void (A::*af1)() throw(A::T) = &A::f; // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}}
   void (A::*af2)() throw() = &A::f; // expected-error-re {{{{not superset|different exception spec}}}}
 
 #if __cplusplus >= 201103L
@@ -144,7 +144,7 @@
   // Likewise, they're instantiated separately from an enclosing class template.
   template<typename U>
   struct B {
-    void f() throw(T, typename U::type) {} // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}}
+    void f() throw(T, typename U::type) {} // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}}
     struct T {};
 
 #if __cplusplus >= 201103L
@@ -161,7 +161,7 @@
     static const int value = true;
   };
 
-  void (B<P>::*bpf1)() throw(B<P>::T, int) = &B<P>::f; // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}}
+  void (B<P>::*bpf1)() throw(B<P>::T, int) = &B<P>::f; // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}}
 #if __cplusplus < 201103L
   // expected-error@-2 {{not superset}}
   // FIXME: We only delay instantiation in C++11 onwards. In C++98, something
@@ -172,7 +172,7 @@
   // the "T has not yet been instantiated" error here, rather than giving
   // confusing errors later on.
 #endif
-  void (B<P>::*bpf2)() throw(int) = &B<P>::f; // expected-error 0-1{{C++1z}} expected-note 0-1{{noexcept}}
+  void (B<P>::*bpf2)() throw(int) = &B<P>::f; // expected-error 0-1{{C++17}} expected-note 0-1{{noexcept}}
 #if __cplusplus <= 201402L
   // expected-error@-2 {{not superset}}
 #else
@@ -194,7 +194,7 @@
 
   template<typename T> int f() throw(typename T::error) { return 0; } // expected-error 1-4{{prior to '::'}} expected-note 0-1{{prior to '::'}} expected-note 0-1{{requested here}}
 #if __cplusplus > 201402L
-    // expected-error@-2 0-1{{C++1z}} expected-note@-2 0-1{{noexcept}}
+    // expected-error@-2 0-1{{C++17}} expected-note@-2 0-1{{noexcept}}
 #endif
   // An exception-specification is needed even if the function is only used in
   // an unevaluated operand.
@@ -203,7 +203,7 @@
   decltype(f<char>()) f2; // expected-note {{instantiation of}}
   bool f3 = noexcept(f<float>()); // expected-note {{instantiation of}}
 #endif
-  // In C++1z onwards, substituting explicit template arguments into the
+  // In C++17 onwards, substituting explicit template arguments into the
   // function type substitutes into the exception specification (because it's
   // part of the type). In earlier languages, we don't notice there's a problem
   // until we've already started to instantiate.
@@ -217,7 +217,7 @@
   template<typename T> struct C {
     C() throw(typename T::type); // expected-error 1-2{{prior to '::'}}
 #if __cplusplus > 201402L
-    // expected-error@-2 0-1{{C++1z}} expected-note@-2 0-1{{noexcept}}
+    // expected-error@-2 0-1{{C++17}} expected-note@-2 0-1{{noexcept}}
 #endif
   };
   struct D : C<void> {}; // ok
diff --git a/test/CXX/drs/dr1xx.cpp b/test/CXX/drs/dr1xx.cpp
index f5395cf..d62ed9f 100644
--- a/test/CXX/drs/dr1xx.cpp
+++ b/test/CXX/drs/dr1xx.cpp
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
 namespace dr100 { // dr100: yes
   template<const char *> struct A {}; // expected-note 0-1{{declared here}}
@@ -313,7 +313,7 @@
     virtual void z() throw(long); // expected-error {{more lax}}
   };
 #else
-  void f() throw(int); // expected-error {{ISO C++1z does not allow}} expected-note {{use 'noexcept}}
+  void f() throw(int); // expected-error {{ISO C++17 does not allow}} expected-note {{use 'noexcept}}
 #endif
 }
 
diff --git a/test/CXX/drs/dr2xx.cpp b/test/CXX/drs/dr2xx.cpp
index a5677a1..4e745ef 100644
--- a/test/CXX/drs/dr2xx.cpp
+++ b/test/CXX/drs/dr2xx.cpp
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
 // PR13819 -- __SIZE_TYPE__ is incompatible.
 typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}}
@@ -984,7 +984,7 @@
 namespace dr294 { // dr294: no
   void f() throw(int);
 #if __cplusplus > 201402L
-    // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}}
+    // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}}
 #endif
   int main() {
     (void)static_cast<void (*)() throw()>(f); // FIXME: ill-formed in C++14 and before
@@ -1001,13 +1001,13 @@
 #endif
     (void)static_cast<void (*)() throw(int)>(f); // FIXME: ill-formed in C++14 and before
 #if __cplusplus > 201402L
-    // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}}
+    // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}}
 #endif
 
     void (*p)() throw() = f; // expected-error-re {{{{not superset|different exception specification}}}}
     void (*q)() throw(int) = f;
 #if __cplusplus > 201402L
-    // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}}
+    // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}}
 #endif
   }
 }
diff --git a/test/CXX/drs/dr4xx.cpp b/test/CXX/drs/dr4xx.cpp
index a30b82f..1a5976e 100644
--- a/test/CXX/drs/dr4xx.cpp
+++ b/test/CXX/drs/dr4xx.cpp
@@ -1,7 +1,7 @@
 // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
 // FIXME: __SIZE_TYPE__ expands to 'long long' on some targets.
 __extension__ typedef __SIZE_TYPE__ size_t;
@@ -507,16 +507,16 @@
   struct S {
     void f() throw(S);
 #if __cplusplus > 201402L
-    // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}}
+    // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}}
 #endif
     void g() throw(T<S>);
 #if __cplusplus > 201402L
-    // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}}
+    // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}}
 #endif
     struct U;
     void h() throw(U);
 #if __cplusplus > 201402L
-    // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}}
+    // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}}
 #endif
     struct U {};
   };
diff --git a/test/CXX/drs/dr5xx.cpp b/test/CXX/drs/dr5xx.cpp
index 97b40b8..5122398 100644
--- a/test/CXX/drs/dr5xx.cpp
+++ b/test/CXX/drs/dr5xx.cpp
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
 
 // FIXME: This is included to avoid a diagnostic with no source location
 // pointing at the implicit operator new. We can't match such a diagnostic
@@ -966,7 +966,7 @@
   template<class T> struct X {
     void f() throw(T) {}
 #if __cplusplus > 201402L
-    // expected-error@-2 {{ISO C++1z does not allow}} expected-note@-2 {{use 'noexcept}}
+    // expected-error@-2 {{ISO C++17 does not allow}} expected-note@-2 {{use 'noexcept}}
 #endif
   };
   struct S {
diff --git a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
index 8c4f36c..ad60868 100644
--- a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
+++ b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
 // RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -std=c++1z -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify %s
 
 struct pr12960 {
   int begin;
@@ -125,7 +125,7 @@
   };
   for (auto a : Differ())
 #if __cplusplus <= 201402L
-    // expected-warning@-2 {{'begin' and 'end' returning different types ('int *' and 'null_t') is a C++1z extension}}
+    // expected-warning@-2 {{'begin' and 'end' returning different types ('int *' and 'null_t') is a C++17 extension}}
     // expected-note@-6 {{selected 'begin' function with iterator type 'int *'}}
     // expected-note@-6 {{selected 'end' function with iterator type 'null_t'}}
 #endif
diff --git a/test/Driver/unknown-std.cpp b/test/Driver/unknown-std.cpp
index 195a671..a7aae51 100644
--- a/test/Driver/unknown-std.cpp
+++ b/test/Driver/unknown-std.cpp
@@ -13,8 +13,8 @@
 // CHECK-NEXT: note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
 // CHECK-NEXT: note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
 // CHECK-NEXT: note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
-// CHECK-NEXT: note: use 'c++1z' for 'Working draft for ISO C++ 2017' standard
-// CHECK-NEXT: note: use 'gnu++1z' for 'Working draft for ISO C++ 2017 with GNU extensions' standard
+// CHECK-NEXT: note: use 'c++17' for 'ISO C++ 2017 with amendments' standard
+// CHECK-NEXT: note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
 // CHECK-NEXT: note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard
 // CHECK-NEXT: note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard
 // CUDA-NEXT: note: use 'cuda' for 'NVIDIA CUDA(tm)' standard
diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp
index 0b7fc62..92c561a2 100644
--- a/test/FixIt/fixit.cpp
+++ b/test/FixIt/fixit.cpp
@@ -216,7 +216,7 @@
 }
 
 template<template<typename> Foo, // expected-error {{template template parameter requires 'class' after the parameter list}}
-         template<typename> typename Bar, // expected-warning {{template template parameter using 'typename' is a C++1z extension}}
+         template<typename> typename Bar, // expected-warning {{template template parameter using 'typename' is a C++17 extension}}
          template<typename> struct Baz> // expected-error {{template template parameter requires 'class' after the parameter list}}
 void func();
 
diff --git a/test/Lexer/hexfloat.cpp b/test/Lexer/hexfloat.cpp
index 163db72..3241751 100644
--- a/test/Lexer/hexfloat.cpp
+++ b/test/Lexer/hexfloat.cpp
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify -pedantic %s
 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s
 // RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify -pedantic %s
-// RUN: %clang_cc1 -std=c++1z -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify -pedantic %s
 double e = 0x.p0; // expected-error-re {{hexadecimal floating {{constant|literal}} requires a significand}}
 
 float f = 0x1p+1;
@@ -9,10 +9,10 @@
 float g = 0x1.2p2;
 double h = 0x1.p2;
 #if __cplusplus <= 201402L
-// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}}
-// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}}
-// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}}
-// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}}
+// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}}
+// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}}
+// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}}
+// expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}}
 #endif
 
 // PR12717: In order to minimally diverge from the C++ standard, we do not lex
diff --git a/test/Modules/Inputs/innerstructredef.h b/test/Modules/Inputs/innerstructredef.h
new file mode 100644
index 0000000..600f44e
--- /dev/null
+++ b/test/Modules/Inputs/innerstructredef.h
@@ -0,0 +1,6 @@
+struct Outer {
+// This definition is actually hidden since only submodule 'one' is imported.
+struct Inner {
+  int x;
+} field;
+};
diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map
index 4cb3e8a..4788daa 100644
--- a/test/Modules/Inputs/module.map
+++ b/test/Modules/Inputs/module.map
@@ -451,3 +451,12 @@
 module objcAtKeywordMissingEnd {
   header "objcAtKeywordMissingEnd.h"
 }
+
+module innerstructredef {
+  module one {
+    header "empty.h"
+  }
+  module two {
+   header "innerstructredef.h"
+  }
+}
diff --git a/test/Modules/inner-struct-redefines-invisible.m b/test/Modules/inner-struct-redefines-invisible.m
new file mode 100644
index 0000000..ecf6d80
--- /dev/null
+++ b/test/Modules/inner-struct-redefines-invisible.m
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -I%S/Inputs -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -verify %s
+// expected-no-diagnostics
+
+@import innerstructredef.one;
+
+struct Outer {
+// Should set lexical context when parsing 'Inner' here, otherwise there's a crash:
+struct Inner {
+  int x;
+} field;
+};
diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp
index 647762f..5db06bd 100644
--- a/test/Parser/cxx0x-attributes.cpp
+++ b/test/Parser/cxx0x-attributes.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -Wc++14-compat -Wc++14-extensions -Wc++1z-extensions %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -Wc++14-compat -Wc++14-extensions -Wc++17-extensions %s
 
 // Need std::initializer_list
 namespace std {
@@ -127,7 +127,7 @@
 [[]] using ns::i; // expected-error {{an attribute list cannot appear here}}
 [[unknown]] using namespace ns; // expected-warning {{unknown attribute 'unknown' ignored}}
 [[noreturn]] using namespace ns; // expected-error {{'noreturn' attribute only applies to functions}}
-namespace [[]] ns2 {} // expected-warning {{attributes on a namespace declaration are incompatible with C++ standards before C++1z}}
+namespace [[]] ns2 {} // expected-warning {{attributes on a namespace declaration are incompatible with C++ standards before C++17}}
 
 using [[]] alignas(4) [[]] ns::i; // expected-error {{an attribute list cannot appear here}}
 using [[]] alignas(4) [[]] foobar = int; // expected-error {{an attribute list cannot appear here}} expected-error {{'alignas' attribute only applies to}}
@@ -179,7 +179,7 @@
 enum [[]] E1;
 enum [[]] E3 : int;
 enum [[]] {
-  k_123 [[]] = 123 // expected-warning {{attributes on an enumerator declaration are incompatible with C++ standards before C++1z}}
+  k_123 [[]] = 123 // expected-warning {{attributes on an enumerator declaration are incompatible with C++ standards before C++17}}
 };
 enum [[]] E1 e; // expected-error {{an attribute list cannot appear here}}
 enum [[]] class E4 { }; // expected-error {{an attribute list cannot appear here}}
@@ -352,7 +352,7 @@
   switch (n) {
   case 0:
     n += 5;
-    [[fallthrough]]; // expected-warning {{use of the 'fallthrough' attribute is a C++1z extension}}
+    [[fallthrough]]; // expected-warning {{use of the 'fallthrough' attribute is a C++17 extension}}
   case 1:
     n *= 2;
     break;
diff --git a/test/Parser/cxx1z-constexpr-lambdas.cpp b/test/Parser/cxx1z-constexpr-lambdas.cpp
index ea000e3..4cf3d12 100644
--- a/test/Parser/cxx1z-constexpr-lambdas.cpp
+++ b/test/Parser/cxx1z-constexpr-lambdas.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++1z %s -verify 
+// RUN: %clang_cc1 -std=c++17 %s -verify 
 // RUN: %clang_cc1 -std=c++14 %s -verify 
 // RUN: %clang_cc1 -std=c++11 %s -verify 
 
@@ -23,9 +23,9 @@
                   { };
 
 #else
-auto L = []() mutable constexpr {return 0; }; //expected-warning{{is a C++1z extension}}
-auto L2 = []() constexpr { return 0;};//expected-warning{{is a C++1z extension}}
-auto L4 = []() constexpr mutable { return 0; }; //expected-warning{{is a C++1z extension}}
+auto L = []() mutable constexpr {return 0; }; //expected-warning{{is a C++17 extension}}
+auto L2 = []() constexpr { return 0;};//expected-warning{{is a C++17 extension}}
+auto L4 = []() constexpr mutable { return 0; }; //expected-warning{{is a C++17 extension}}
 #endif
 
 
diff --git a/test/Parser/cxx1z-nested-namespace-definition.cpp b/test/Parser/cxx1z-nested-namespace-definition.cpp
index 96f34c5..e5e809a 100644
--- a/test/Parser/cxx1z-nested-namespace-definition.cpp
+++ b/test/Parser/cxx1z-nested-namespace-definition.cpp
@@ -2,13 +2,13 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 // RUN: not %clang_cc1 -x c++ -fixit %t -Werror -DFIXIT
 // RUN: %clang_cc1 -x c++ %t -DFIXIT
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1z -Wc++14-compat
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 -Wc++14-compat
 
 namespace foo1::foo2::foo3 {
 #if __cplusplus <= 201400L
-// expected-warning@-2 {{nested namespace definition is a C++1z extension; define each namespace separately}}
+// expected-warning@-2 {{nested namespace definition is a C++17 extension; define each namespace separately}}
 #else
-// expected-warning@-4 {{nested namespace definition is incompatible with C++ standards before C++1z}}
+// expected-warning@-4 {{nested namespace definition is incompatible with C++ standards before C++17}}
 #endif
   int foo(int x) { return x; }
 }
diff --git a/test/SemaCXX/cxx0x-compat.cpp b/test/SemaCXX/cxx0x-compat.cpp
index bcf0cf1..8f7aaab 100644
--- a/test/SemaCXX/cxx0x-compat.cpp
+++ b/test/SemaCXX/cxx0x-compat.cpp
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wc++11-compat -verify %s
-// RUN: %clang_cc1 -fsyntax-only -std=c++1z -Wc++11-compat -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wc++11-compat -verify %s
 
 #if __cplusplus < 201103L
 
@@ -42,14 +42,14 @@
 char c = 'x'_x; // expected-warning {{will be treated as a user-defined literal suffix}}
 
 template<int ...N> int f() { // expected-warning {{C++11 extension}}
-  return (N + ...); // expected-warning {{C++1z extension}}
+  return (N + ...); // expected-warning {{C++17 extension}}
 }
 
 #else
 
 auto init_capture = [a(0)] {}; // expected-warning {{initialized lambda captures are incompatible with C++ standards before C++14}}
-static_assert(true); // expected-warning {{incompatible with C++ standards before C++1z}}
+static_assert(true); // expected-warning {{incompatible with C++ standards before C++17}}
 
-template<int ...N> int f() { return (N + ...); } // expected-warning {{incompatible with C++ standards before C++1z}}
+template<int ...N> int f() { return (N + ...); } // expected-warning {{incompatible with C++ standards before C++17}}
 
 #endif
diff --git a/test/SemaCXX/cxx1z-init-statement.cpp b/test/SemaCXX/cxx1z-init-statement.cpp
index 4afe040..d37acd0 100644
--- a/test/SemaCXX/cxx1z-init-statement.cpp
+++ b/test/SemaCXX/cxx1z-init-statement.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -std=c++1z -verify %s
+// RUN: %clang_cc1 -std=c++17 -verify %s
 
 void testIf() {
   int x = 0;
diff --git a/test/SemaCXX/deprecated.cpp b/test/SemaCXX/deprecated.cpp
index ac477d4..26f30c9 100644
--- a/test/SemaCXX/deprecated.cpp
+++ b/test/SemaCXX/deprecated.cpp
@@ -1,9 +1,9 @@
 // RUN: %clang_cc1 -std=c++98 %s -Wdeprecated -verify -triple x86_64-linux-gnu
 // RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify -triple x86_64-linux-gnu
-// RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify -triple x86_64-linux-gnu
-// RUN: %clang_cc1 -std=c++1z %s -Wdeprecated -verify -triple x86_64-linux-gnu
+// RUN: %clang_cc1 -std=c++14 %s -Wdeprecated -verify -triple x86_64-linux-gnu
+// RUN: %clang_cc1 -std=c++17 %s -Wdeprecated -verify -triple x86_64-linux-gnu
 
-// RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify -triple x86_64-linux-gnu -Wno-deprecated-register -DNO_DEPRECATED_FLAGS
+// RUN: %clang_cc1 -std=c++14 %s -Wdeprecated -verify -triple x86_64-linux-gnu -Wno-deprecated-register -DNO_DEPRECATED_FLAGS
 
 #include "Inputs/register.h"
 
@@ -12,8 +12,8 @@
 void i() throw(...);
 #if __cplusplus > 201402L
 // expected-warning@-4 {{dynamic exception specifications are deprecated}} expected-note@-4 {{use 'noexcept' instead}}
-// expected-error@-4 {{ISO C++1z does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}}
-// expected-error@-4 {{ISO C++1z does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}}
+// expected-error@-4 {{ISO C++17 does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}}
+// expected-error@-4 {{ISO C++17 does not allow dynamic exception specifications}} expected-note@-4 {{use 'noexcept(false)' instead}}
 #elif __cplusplus >= 201103L
 // expected-warning@-8 {{dynamic exception specifications are deprecated}} expected-note@-8 {{use 'noexcept' instead}}
 // expected-warning@-8 {{dynamic exception specifications are deprecated}} expected-note@-8 {{use 'noexcept(false)' instead}}
@@ -23,7 +23,7 @@
 void stuff() {
   register int n;
 #if __cplusplus > 201402L
-  // expected-error@-2 {{ISO C++1z does not allow 'register' storage class specifier}}
+  // expected-error@-2 {{ISO C++17 does not allow 'register' storage class specifier}}
 #elif __cplusplus >= 201103L && !defined(NO_DEPRECATED_FLAGS)
   // expected-warning@-4 {{'register' storage class specifier is deprecated}}
 #endif
@@ -34,14 +34,14 @@
   bool b;
   ++b;
 #if __cplusplus > 201402L
-  // expected-error@-2 {{ISO C++1z does not allow incrementing expression of type bool}}
+  // expected-error@-2 {{ISO C++17 does not allow incrementing expression of type bool}}
 #else
   // expected-warning@-4 {{incrementing expression of type bool is deprecated}}
 #endif
 
   b++;
 #if __cplusplus > 201402L
-  // expected-error@-2 {{ISO C++1z does not allow incrementing expression of type bool}}
+  // expected-error@-2 {{ISO C++17 does not allow incrementing expression of type bool}}
 #else
   // expected-warning@-4 {{incrementing expression of type bool is deprecated}}
 #endif
diff --git a/test/SemaCXX/inline.cpp b/test/SemaCXX/inline.cpp
index b20bc18..ba29521 100644
--- a/test/SemaCXX/inline.cpp
+++ b/test/SemaCXX/inline.cpp
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++1z %s -Wc++98-c++11-c++14-compat
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s -Wc++98-c++11-c++14-compat
 
 // Check that we don't allow illegal uses of inline
 // (checking C++-only constructs here)
@@ -12,7 +12,7 @@
 
 // Check that we warn appropriately.
 #if __cplusplus <= 201402L
-inline int a; // expected-warning{{inline variables are a C++1z extension}}
+inline int a; // expected-warning{{inline variables are a C++17 extension}}
 #else
-inline int a; // expected-warning{{inline variables are incompatible with C++ standards before C++1z}}
+inline int a; // expected-warning{{inline variables are incompatible with C++ standards before C++17}}
 #endif
diff --git a/test/SemaCXX/static-assert.cpp b/test/SemaCXX/static-assert.cpp
index 7de4d07..196375c 100644
--- a/test/SemaCXX/static-assert.cpp
+++ b/test/SemaCXX/static-assert.cpp
@@ -49,5 +49,5 @@
 StaticAssertProtected<int> sap1;
 StaticAssertProtected<X> sap2; // expected-note {{instantiation}}
 
-static_assert(true); // expected-warning {{C++1z extension}}
+static_assert(true); // expected-warning {{C++17 extension}}
 static_assert(false); // expected-error-re {{failed{{$}}}} expected-warning {{extension}}
diff --git a/test/SemaCXX/warn-c++1z-extensions.cpp b/test/SemaCXX/warn-c++1z-extensions.cpp
index 9b5e1c2..a0d44a3 100644
--- a/test/SemaCXX/warn-c++1z-extensions.cpp
+++ b/test/SemaCXX/warn-c++1z-extensions.cpp
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -fsyntax-only -std=c++14 -verify %s
 
 void f() {
-  if (bool b = true; b) {} // expected-warning {{'if' initialization statements are a C++1z extension}}
-  switch (int n = 5; n) { // expected-warning {{'switch' initialization statements are a C++1z extension}}
+  if (bool b = true; b) {} // expected-warning {{'if' initialization statements are a C++17 extension}}
+  switch (int n = 5; n) { // expected-warning {{'switch' initialization statements are a C++17 extension}}
   case 5: break;
   }
 }
diff --git a/test/SemaTemplate/temp_arg_nontype_cxx11.cpp b/test/SemaTemplate/temp_arg_nontype_cxx11.cpp
index cfaad0c..0b8f0ee 100644
--- a/test/SemaTemplate/temp_arg_nontype_cxx11.cpp
+++ b/test/SemaTemplate/temp_arg_nontype_cxx11.cpp
@@ -25,7 +25,7 @@
 }
 
 namespace Auto {
-  template<auto> struct A { };  // expected-error {{until C++1z}}
+  template<auto> struct A { };  // expected-error {{until C++17}}
 }
 
 namespace check_conversion_early {