PR c++/65072
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 20 Mar 2015 14:56:53 +0000 (14:56 +0000)
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 20 Mar 2015 14:56:53 +0000 (14:56 +0000)
* typeck.c (lookup_anon_field): Make sure we're dealing with the main
variant.

* g++.dg/cpp0x/pr65072.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221535 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr65072.C [new file with mode: 0644]

index f90e447..dadf673 100644 (file)
@@ -1,3 +1,9 @@
+2015-03-20  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/65072
+       * typeck.c (lookup_anon_field): Make sure we're dealing with the main
+       variant.
+
 2015-03-19  Jason Merrill  <jason@redhat.com>
 
        PR c++/65046
index 4c128b7..e9d4cae 100644 (file)
@@ -2213,6 +2213,8 @@ lookup_anon_field (tree t, tree type)
 {
   tree field;
 
+  t = TYPE_MAIN_VARIANT (t);
+
   for (field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field))
     {
       if (TREE_STATIC (field))
index 884fb62..c489b28 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-20  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/65072
+       * g++.dg/cpp0x/pr65072.C: New test.
+
 2015-03-20  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/64715
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr65072.C b/gcc/testsuite/g++.dg/cpp0x/pr65072.C
new file mode 100644 (file)
index 0000000..b8fa888
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/65075
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wno-pedantic" }
+
+template <typename> class C
+{
+  struct
+  {
+    int i;
+  };
+  auto operator*(const C m) -> decltype (m.i);
+};
+void fn1 (const C<float>);
+C<float> a;