diff options
author | Jason Merrill <jason@redhat.com> | 2013-04-22 16:33:01 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2013-04-22 16:33:01 -0400 |
commit | af580858ea4338535dfb2ae4a28cbda18d1b50d0 (patch) | |
tree | 8bea61e6885384f6ec206abf5e26727b749f8bc4 /gcc | |
parent | 0462b6aa20fd6734f7497f5eed9496d33701a952 (diff) | |
download | gcc-af580858ea4338535dfb2ae4a28cbda18d1b50d0.zip gcc-af580858ea4338535dfb2ae4a28cbda18d1b50d0.tar.gz gcc-af580858ea4338535dfb2ae4a28cbda18d1b50d0.tar.bz2 |
error.c (dump_aggr_type): Fix lambda detection.
* error.c (dump_aggr_type): Fix lambda detection.
(dump_simple_decl): Pretty-print capture field.
From-SVN: r198159
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/error.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/lambda/lambda-diag1.C | 8 |
3 files changed, 22 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 57c2fc3..c91f3ec 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2013-04-22 Jason Merrill <jason@redhat.com> + * error.c (dump_aggr_type): Fix lambda detection. + (dump_simple_decl): Pretty-print capture field. + N3323 * cvt.c (build_expr_type_conversion): Two conversions that return the same type aren't necessarily ambiguous. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 6bac7ec..3206342 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -656,7 +656,7 @@ dump_aggr_type (tree t, int flags) else pp_printf (pp_base (cxx_pp), M_("<anonymous %s>"), variety); } - else if (LAMBDA_TYPE_P (name)) + else if (LAMBDA_TYPE_P (t)) { /* A lambda's "type" is essentially its signature. */ pp_string (cxx_pp, M_("<lambda")); @@ -933,7 +933,16 @@ dump_simple_decl (tree t, tree type, int flags) && TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (t))) pp_string (cxx_pp, "..."); if (DECL_NAME (t)) - dump_decl (DECL_NAME (t), flags); + { + if (DECL_CLASS_SCOPE_P (t) && LAMBDA_TYPE_P (DECL_CONTEXT (t))) + { + pp_character (cxx_pp, '<'); + pp_string (cxx_pp, IDENTIFIER_POINTER (DECL_NAME (t)) + 2); + pp_string (cxx_pp, " capture>"); + } + else + dump_decl (DECL_NAME (t), flags); + } else pp_string (cxx_pp, M_("<anonymous>")); if (flags & TFF_DECL_SPECIFIERS) diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-diag1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-diag1.C new file mode 100644 index 0000000..dc1043b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-diag1.C @@ -0,0 +1,8 @@ +// { dg-require-effective-target c++11 } + +int main() +{ + int x; + auto f = [x]{ }; + f.__x.foo; // { dg-error "<lambda\\(\\)>::<x capture>" } +} |