re PR c++/17149 (ICE: tree check: expected record_type or union_type or qual_union_ty...
authorNathan Sidwell <nathan@gcc.gnu.org>
Tue, 24 Aug 2004 09:04:06 +0000 (09:04 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Tue, 24 Aug 2004 09:04:06 +0000 (09:04 +0000)
cp:
        PR c++/17149
        * semantics.c (check_accessibility_of_qualified_id): Defer check
        if qualifying_type is a template parameter.
testsuite:
        PR c++/17149
        * g++.dg/template/access15.C: New.

From-SVN: r86472

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/access15.C [new file with mode: 0644]

index 7e013c792258b6b4eedd683769e26bc9ffa9dea0..ddeb19ed1643f1d216ed9c1d344fc3fc9a9ff371 100644 (file)
@@ -1,3 +1,9 @@
+2004-08-24  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/17149
+       * semantics.c (check_accessibility_of_qualified_id): Defer check
+       if qualifying_type is a template parameter.
+
 2004-08-23  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/17163
@@ -11,7 +17,7 @@
        Revert:
        2004-08-22  Andrew Pinski  <apinski@apple.com>
        PR c++/14029
-       * typeck.c (build_unary_op): Use &a.b if the foldded lowered
+       * typeck.c (build_unary_op): Use &a.b if the folded lowered
        expression is not constant.
 
 2004-08-23  Nathan Sidwell  <nathan@codesourcery.com>
@@ -23,7 +29,7 @@
 2004-08-22  Andrew Pinski  <apinski@apple.com>
 
        PR c++/14029
-       * typeck.c (build_unary_op): Use &a.b if the foldded lowered
+       * typeck.c (build_unary_op): Use &a.b if the folded lowered
        expression is not constant.
 
 2004-08-20  Mark Mitchell  <mark@codesourcery.com>
index 302d00ecc779b3367e60becc8e170942ab982e8c..b221cd20b1caa1ca89ff36b68d04d44980201059 100644 (file)
@@ -1384,7 +1384,9 @@ check_accessibility_of_qualified_id (tree decl,
        its bases.  */
     qualifying_type = currently_open_derived_class (scope);
 
-  if (qualifying_type)
+  if (qualifying_type && IS_AGGR_TYPE_CODE (TREE_CODE (qualifying_type)))
+    /* It is possible for qualifying type to be a TEMPLATE_TYPE_PARM
+       or similar in a default argument value.  */
     perform_or_defer_access_check (TYPE_BINFO (qualifying_type), decl);
 }
 
index 343d3bba591910101d0eacf885bf5cd07ef944c9..59138e2cd2a9aa4657e5aa2fa245f86976573e34 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-24  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/17149
+       * g++.dg/template/access15.C: New.
+
 2004-08-23  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/17163
diff --git a/gcc/testsuite/g++.dg/template/access15.C b/gcc/testsuite/g++.dg/template/access15.C
new file mode 100644 (file)
index 0000000..e287163
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-do compile }
+
+// Copyright (C) 2004 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 23 Aug 2004 <nathan@codesourcery.com>
+// Origin: stefaandr@hotmail.com
+
+// Bug 17149: ICE with TEMPLATE_TYPE_PARM
+
+
+template <class super,
+         int (super::tdata::*member)() const = &super::tdata::operator()>
+struct x {};