[cfe-commits] r155788 - in /cfe/trunk: lib/Parse/ParseDeclCXX.cpp test/CXX/class/class.mem/p2.cpp

Douglas Gregor dgregor at apple.com
Sun Apr 29 19:13:21 PDT 2012


Trivial fix for a regression. Approved. 

Sent from my iPhone

On Apr 29, 2012, at 5:20 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> 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 <richard-llvm at metafoo.co.uk> 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
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120429/8e822ea8/attachment.html>


More information about the cfe-commits mailing list