]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/21025 (ICE on template)
authorMark Mitchell <mark@codesourcery.com>
Sun, 17 Apr 2005 03:37:16 +0000 (03:37 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 17 Apr 2005 03:37:16 +0000 (03:37 +0000)
PR c++/21025
* typeck.c (cxx_sizeof_or_alignof_type): Check whether the type to
which sizeof/alignof is dependent, rather than just whether we are
processing_template_decl.

PR c++/21025
* g++.dg/template/sizeof9.C: New test.

From-SVN: r98250

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

index f78e00e8bd7efac96a31871828f27398779bdaec..8b7d0b97d57c8339179d7fbed60ec4957eac6bf4 100644 (file)
@@ -1,3 +1,10 @@
+2005-04-16  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/21025
+       * typeck.c (cxx_sizeof_or_alignof_type): Check whether the type to
+       which sizeof/alignof is dependent, rather than just whether we are
+       processing_template_decl.
+       
 2005-04-06  Jason Merrill  <jason@redhat.com>
 
        PR c++/19312
index adcddaf7b3f165c2cd8aaea4a7be62353fbf6936..648f95f3596c5a5db3d8a2ff24d33388810f73ef 100644 (file)
@@ -1216,7 +1216,7 @@ cxx_sizeof_or_alignof_type (tree type, enum tree_code op, bool complain)
   if (type == error_mark_node)
     return error_mark_node;
   
-  if (processing_template_decl)
+  if (dependent_type_p (type))
     {
       value = build_min (op, size_type_node, type);
       TREE_READONLY (value) = 1;
index 3f265edc037d2e9106ea5f0a62810a0c62e7910c..110fb3ab4deb0ec777e69f84adf6dad30c5a7cb6 100644 (file)
@@ -1,3 +1,8 @@
+2005-04-16  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/21025
+       * g++.dg/template/sizeof9.C: New test.
+
 2005-04-04  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/20679
diff --git a/gcc/testsuite/g++.dg/template/sizeof9.C b/gcc/testsuite/g++.dg/template/sizeof9.C
new file mode 100644 (file)
index 0000000..8d9ec95
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/21025
+
+template<int N> struct X { char x[N]; };
+template<typename T> X<1 + sizeof(T) - sizeof(T)> F(T const &);
+template<int N> struct S { int d() { F(1); } };
+