diff options
author | Jason Merrill <jason@redhat.com> | 2013-02-13 23:30:26 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2013-02-13 23:30:26 -0500 |
commit | e75e98f270478aca1c8c823171e8d29d471bfc87 (patch) | |
tree | 4370cd4ecc6af46e95b23306a97c07e991b4f5fa /gcc | |
parent | 561f7fc72cbe475f1661e457731bb7d3b99f82a1 (diff) | |
download | gcc-e75e98f270478aca1c8c823171e8d29d471bfc87.zip gcc-e75e98f270478aca1c8c823171e8d29d471bfc87.tar.gz gcc-e75e98f270478aca1c8c823171e8d29d471bfc87.tar.bz2 |
re PR c++/55680 ([C++11] Member specialization with lambda is rejected)
PR c++/55680
* pt.c (maybe_process_partial_specialization): A lambda
isn't what's being specialized.
From-SVN: r196042
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template8.C | 7 |
3 files changed, 16 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7cb0653..d28a604 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2013-02-13 Jason Merrill <jason@redhat.com> + PR c++/55680 + * pt.c (maybe_process_partial_specialization): A lambda + isn't what's being specialized. + PR c++/55710 * semantics.c (maybe_add_lambda_conv_op): Mark static thunk TREE_USED. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2aadd4d..bd44fde 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -802,6 +802,11 @@ maybe_process_partial_specialization (tree type) if (type == error_mark_node) return error_mark_node; + /* A lambda that appears in specialization context is not itself a + specialization. */ + if (CLASS_TYPE_P (type) && CLASSTYPE_LAMBDA_EXPR (type)) + return type; + if (TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM) { error ("name of class shadows template template parameter %qD", diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template8.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template8.C new file mode 100644 index 0000000..720941d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template8.C @@ -0,0 +1,7 @@ +// PR c++/55680 +// { dg-do compile { target c++11 } } + +template <class T> struct X { + static void (* code ) (); +}; +template <> void (* X<int>::code ) () = [](){}; |