]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/46058 (gcc crashes with lvalue error on the following Code)
authorJason Merrill <jason@redhat.com>
Fri, 3 Dec 2010 18:44:04 +0000 (13:44 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 3 Dec 2010 18:44:04 +0000 (13:44 -0500)
PR c++/46058
* tree.c (lvalue_kind) [SCOPE_REF]: Handle non-dependent case.

From-SVN: r167438

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

index 36e7a1366d6e978c821d2482d997384f6541812c..a58e8cb3434556bedf4fb4894300327a3b9475d2 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-03  Jason Merrill  <jason@redhat.com>
+
+       PR c++/46058
+       * tree.c (lvalue_kind) [SCOPE_REF]: Handle non-dependent case.
+
 2010-11-11  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
index ab0e95336ba3a138e44e07518243803f28466817..54b76a8503072f60417928de6f311aa58975bc79 100644 (file)
@@ -152,9 +152,12 @@ lvalue_p_1 (const_tree ref)
        return clk_ordinary;
       break;
 
-      /* A currently unresolved scope ref.  */
+      /* A scope ref in a template, left as SCOPE_REF to support later
+        access checking.  */
     case SCOPE_REF:
-      gcc_unreachable ();
+      gcc_assert (!type_dependent_expression_p (CONST_CAST_TREE(ref)));
+      return lvalue_p_1 (TREE_OPERAND (ref, 1));
+
     case MAX_EXPR:
     case MIN_EXPR:
       /* Disallow <? and >? as lvalues if either argument side-effects.  */
index 3e6a47e60cce0cd27d2e9193e77372ed1ebb3d50..72416028397d096b8e9df87c808df3bf717924f2 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-03  Jason Merrill  <jason@redhat.com>
+
+       PR c++/46058
+       * g++.dg/template/scope4.C: New.
+
 2010-12-03  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        Backport from mainline:
diff --git a/gcc/testsuite/g++.dg/template/scope4.C b/gcc/testsuite/g++.dg/template/scope4.C
new file mode 100644 (file)
index 0000000..a4ae074
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/46058
+
+class StringLiterals {
+public:
+   static const char dec[];
+};
+
+template<class St, class Base, const char* name>
+class NoValueCommand : public Base {
+public:
+};
+
+template<class St, class Base>
+class DecBasic : public NoValueCommand<St,Base,StringLiterals::dec> {
+};