This and r155784 fix crash-on-invalid bugs, and this one is a regression
from 3.0. Do we want these on the branch?

On Sun, Apr 29, 2012 at 12:31 AM, Richard Smith
<[email protected]>wrote:

> Author: rsmith
> Date: Sun Apr 29 02:31:09 2012
> New Revision: 155788
>
> URL: http://llvm.org/viewvc/llvm-project?rev=155788&view=rev
> Log:
> PR12688: ParseCXXClassMemberDeclaration's sometimes-null ThisDecl takes
> another
> victim. Don't crash if we have a delay-parsed exception specification for a
> class member which is invalid in a way which precludes building a
> FunctionDecl.
>
> Modified:
>    cfe/trunk/lib/Parse/ParseDeclCXX.cpp
>    cfe/trunk/test/CXX/class/class.mem/p2.cpp
>
> Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=155788&r1=155787&r2=155788&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
> +++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sun Apr 29 02:31:09 2012
> @@ -2065,7 +2065,7 @@
>       DeclsInGroup.push_back(ThisDecl);
>     }
>
> -    if (DeclaratorInfo.isFunctionDeclarator() &&
> +    if (ThisDecl && DeclaratorInfo.isFunctionDeclarator() &&
>         DeclaratorInfo.getDeclSpec().getStorageClassSpec()
>           != DeclSpec::SCS_typedef) {
>       HandleMemberFunctionDeclDelays(DeclaratorInfo, ThisDecl);
>
> Modified: cfe/trunk/test/CXX/class/class.mem/p2.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/class.mem/p2.cpp?rev=155788&r1=155787&r2=155788&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CXX/class/class.mem/p2.cpp (original)
> +++ cfe/trunk/test/CXX/class/class.mem/p2.cpp Sun Apr 29 02:31:09 2012
> @@ -73,3 +73,16 @@
>   static_assert(!noexcept(S().h()), "");
>   static_assert(noexcept(S::i()), "");
>  }
> +
> +namespace PR12688 {
> +  struct S {
> +    // FIXME: Producing one error saying this can't have the same name
> +    //        as the class because it's not a constructor, then producing
> +    //        another error saying this can't have a return type because
> +    //        it is a constructor, is redundant and inconsistent.
> +    nonsense S() throw (more_nonsense); // \
> +    // expected-error {{'nonsense'}} \
> +    // expected-error {{has the same name as its class}} \
> +    // expected-error {{constructor cannot have a return type}}
> +  };
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to