<p dir="ltr"><br>
On 28 Jun 2014 02:41, "Ehsan Akhgari" <<a href="mailto:ehsan.akhgari@gmail.com">ehsan.akhgari@gmail.com</a>> wrote:<br>
><br>
> Hi rnk,<br>
><br>
> This fixes <a href="http://llvm.org/PR20145">http://llvm.org/PR20145</a>.<br>
><br>
> <a href="http://reviews.llvm.org/D4333">http://reviews.llvm.org/D4333</a><br>
><br>
> Files:<br>
>   include/clang/Basic/DiagnosticSemaKinds.td<br>
>   lib/Sema/SemaDecl.cpp<br>
>   test/SemaCXX/MicrosoftExtensions.cpp<br>
><br>
> Index: include/clang/Basic/DiagnosticSemaKinds.td<br>
> ===================================================================<br>
> --- include/clang/Basic/DiagnosticSemaKinds.td<br>
> +++ include/clang/Basic/DiagnosticSemaKinds.td<br>
> @@ -4724,6 +4724,9 @@<br>
>  def err_standalone_class_nested_name_specifier : Error<<br>
>    "forward declaration of %select{class|struct|interface|union|enum}0 cannot "<br>
>    "have a nested name specifier">;<br>
> +def warn_standalone_class_nested_name_specifier : ExtWarn<<br>
> +  "forward declaration of %select{class|struct|interface|union|enum}0 with a "<br>
> +  "nested name specifier is a Microsoft extension">, InGroup<Microsoft>;</p>
<p dir="ltr">An ExtWarn should be named ext_...</p>
<p dir="ltr">>  def err_typecheck_sclass_func : Error<"illegal storage class on function">;<br>
>  def err_static_block_func : Error<<br>
>    "function declared in block scope cannot have 'static' storage class">;<br>
> Index: lib/Sema/SemaDecl.cpp<br>
> ===================================================================<br>
> --- lib/Sema/SemaDecl.cpp<br>
> +++ lib/Sema/SemaDecl.cpp<br>
> @@ -3286,7 +3286,10 @@<br>
>      // nested-name-specifier unless it is an explicit instantiation<br>
>      // or an explicit specialization.<br>
>      // Per C++ [dcl.enum]p1, an opaque-enum-declaration can't either.<br>
> -    Diag(SS.getBeginLoc(), diag::err_standalone_class_nested_name_specifier)<br>
> +    Diag(SS.getBeginLoc(),<br>
> +         getLangOpts().MicrosoftExt ?<br>
> +           diag::warn_standalone_class_nested_name_specifier :<br>
> +           diag::err_standalone_class_nested_name_specifier)<br>
>        << (DS.getTypeSpecType() == DeclSpec::TST_class ? 0 :<br>
>            DS.getTypeSpecType() == DeclSpec::TST_struct ? 1 :<br>
>            DS.getTypeSpecType() == DeclSpec::TST_interface ? 2 :<br>
> Index: test/SemaCXX/MicrosoftExtensions.cpp<br>
> ===================================================================<br>
> --- test/SemaCXX/MicrosoftExtensions.cpp<br>
> +++ test/SemaCXX/MicrosoftExtensions.cpp<br>
> @@ -418,3 +418,19 @@<br>
>    _Static_assert(__alignof(s1) == 8, "");<br>
>    _Static_assert(__alignof(s2) == 4, "");<br>
>  }<br>
> +<br>
> +namespace forward_decl_nested_name_NS {<br>
> +  struct X;<br>
> +  template<typename T> struct Y;<br>
> +}<br>
> +<br>
> +struct forward_decl_nested_name_NS::X; // expected-warning {{forward declaration of struct with a nested name specifier is a Microsoft extension}}<br>
> +template<typename T> struct forward_decl_nested_name_NS::Y; // expected-warning {{forward declaration of struct with a nested name specifier is a Microsoft extension}}<br>
> +<br>
> +struct forward_decl_nested_name_struct {<br>
> +  struct A;<br>
> +  union B;<br>
> +};<br>
> +<br>
> +struct forward_decl_nested_name_struct::A; // expected-warning {{forward declaration of struct with a nested name specifier is a Microsoft extension}}<br>
> +union forward_decl_nested_name_struct::B; // expected-warning {{forward declaration of union with a nested name specifier is a Microsoft extension}}<br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
><br>
</p>