aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-01-11 06:29:58 -0500
committerJason Merrill <jason@gcc.gnu.org>2011-01-11 06:29:58 -0500
commit41d04a8dfe0313dd2a4e2501d9ab6d1f06378dbf (patch)
tree494bc25a9ec1cd7425808fcf0f646674ee0bb672 /gcc
parent5826c8d29eb8182a03ba533bdaed122ada974521 (diff)
downloadgcc-41d04a8dfe0313dd2a4e2501d9ab6d1f06378dbf.zip
gcc-41d04a8dfe0313dd2a4e2501d9ab6d1f06378dbf.tar.gz
gcc-41d04a8dfe0313dd2a4e2501d9ab6d1f06378dbf.tar.bz2
re PR c++/45520 ([C++0x] compiler segmentation fault on decltype in lambda-declarator)
PR c++/45520 * tree.c (maybe_dummy_object): Check current_class_ref against context, not current_class_type. From-SVN: r168654
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/tree.c12
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this3.C14
4 files changed, 31 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4cfe3e6..be7497a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-11 Jason Merrill <jason@redhat.com>
+
+ PR c++/45520
+ * tree.c (maybe_dummy_object): Check current_class_ref against
+ context, not current_class_type.
+
2011-01-08 Nicola Pero <nicola.pero@meta-innovation.com>
PR objc/47078
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index dcce44a..213279a 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2374,12 +2374,12 @@ maybe_dummy_object (tree type, tree* binfop)
if (binfop)
*binfop = binfo;
- if (current_class_ref && context == current_class_type
- /* Kludge: Make sure that current_class_type is actually
- correct. It might not be if we're in the middle of
- tsubst_default_argument. */
- && same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (current_class_ref)),
- current_class_type))
+ if (current_class_ref
+ /* current_class_ref might not correspond to current_class_type if
+ we're in tsubst_default_argument or a lambda-declarator; in either
+ case, we want to use current_class_ref if it matches CONTEXT. */
+ && (same_type_ignoring_top_level_qualifiers_p
+ (TREE_TYPE (current_class_ref), context)))
decl = current_class_ref;
else if (current != current_class_type
&& context == nonlambda_method_basetype ())
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2204146..999a713 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-11 Jason Merrill <jason@redhat.com>
+
+ PR c++/45520
+ * g++.dg/cpp0x/lambda/lambda-this3.C: New.
+
2011-01-11 Iain Sandoe <iains@gcc.gnu.org>
* objc-obj-c++-shared/next-mapping.h: Add copyright header.
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this3.C
new file mode 100644
index 0000000..de0d357
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this3.C
@@ -0,0 +1,14 @@
+// PR c++/45520
+// { dg-options -std=c++0x }
+
+struct M {
+ int i;
+};
+
+struct S {
+ M m;
+
+ void f() {
+ auto lambda=[&](decltype(m.i) & i) { };
+ }
+};