From bfdb108fc5e627e740d096ee96ea6e1b10891e66 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 12 Mar 2012 08:56:40 +0000 Subject: Fix parsing of trailing-return-type. Types are syntactically prohibited from being defined here: [] () -> struct S {} does not define struct S. In passing, implement DR1318 (syntactic disambiguation of 'final'). llvm-svn: 152551 --- clang/test/Parser/cxx0x-lambda-expressions.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'clang/test/Parser/cxx0x-lambda-expressions.cpp') diff --git a/clang/test/Parser/cxx0x-lambda-expressions.cpp b/clang/test/Parser/cxx0x-lambda-expressions.cpp index 87d14051e92..9c719414212 100644 --- a/clang/test/Parser/cxx0x-lambda-expressions.cpp +++ b/clang/test/Parser/cxx0x-lambda-expressions.cpp @@ -1,5 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify -std=c++11 %s +enum E { e }; + class C { int f() { @@ -19,6 +21,8 @@ class C { [=,&foo] () {}; [&,foo] () {}; [this] () {}; + [] () -> class C { return C(); }; + [] () -> enum E { return e; }; [] -> int { return 0; }; // expected-error{{lambda requires '()' before return type}} [] mutable -> int { return 0; }; // expected-error{{lambda requires '()' before 'mutable'}} @@ -37,4 +41,3 @@ class C { int a6[1] = {[this] = 1 }; // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'C *'}} } }; - -- cgit v1.2.3