User account creation filtered due to spam.

Bug 19208 - [3.4 Regression] Spurious error about variably modified type
Summary: [3.4 Regression] Spurious error about variably modified type
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P1 critical
Target Milestone: 3.4.5
Assignee: Giovanni Bajo
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: monitored, patch, rejects-valid
Depends on:
Blocks: 24671
  Show dependency treegraph
 
Reported: 2004-12-30 13:18 UTC by Giovanni Bajo
Modified: 2005-07-25 21:13 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.3.3
Known to fail: 3.4.3 3.4.0
Last reconfirmed: 2005-02-26 18:42:31


Attachments
Reduced testcase (but not minimal) (931 bytes, text/plain)
2004-12-30 13:19 UTC, Giovanni Bajo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Giovanni Bajo 2004-12-30 13:18:22 UTC
Hello,

the code I will attacch shortly is a (partial) reduction from a multi-thousands 
line testcase from Boost which fails with 4.0.

This is the link to the failure in the automatic testers:
http://ln-s.net/2$N
Comment 1 Giovanni Bajo 2004-12-30 13:19:33 UTC
Created attachment 7845 [details]
Reduced testcase (but not minimal)
Comment 2 Steven Bosscher 2004-12-30 13:22:04 UTC
A regression from what?  Does 3.4 accept it?
Comment 3 Giovanni Bajo 2004-12-30 13:51:24 UTC
3.4 is broken too, it's a regression from 3.3 actually.
Comment 4 Andrew Pinski 2004-12-30 14:27:09 UTC
Reduced testcase:
template <class C> struct if_t { typedef int type; };
template <class T> struct ffff { static const bool value = true; };
template <class A>
struct bound_member_action
{
  typedef char f[ffff<A>::value ? 1 : 2];
  template <class CT>
  bound_member_action(CT i, typename if_t<f>::type g)  {}
};
bound_member_action<int> a(0, 1);



: Search converges between 2004-01-27-trunk (#442) and 2004-01-28-trunk (#443).

Just a note that date is when it started to seg fault.
We started to reject this (and not an ICE):
: Search converges between 2004-03-01-3.4 (#2) and 2004-03-15-3.4 (#3).
: Search converges between 2004-03-01-trunk (#446) and 2004-04-01-trunk (#447).
Comment 5 Steven Solie 2005-01-15 23:10:30 UTC
Please add 3.4.2 to known to fail list.

7.Code:test> g++ -c bound_member.cpp
bound_member.cpp: In instantiation of `bound_member_action<int>':
bound_member.cpp:10:   instantiated from here
bound_member.cpp:8: error: `char[(ffff<int>::value ? 1 : 2)]' is a variably modified type
bound_member.cpp:8: error:   trying to instantiate `template<class C> struct if_t'
bound_member.cpp:10: error: no matching function for call to `bound_member_action<int>::bound_member_action(int, int)'
bound_member.cpp:5: note: candidates are: bound_member_action<int>::bound_member_action(const bound_member_action<int>&)

g++ (GCC) 3.4.2 (Amiga, Inc. build 20040910)

Encountered when building Boost Spirit/Phoenix library test suite.
Comment 6 Giovanni Bajo 2005-01-20 03:08:01 UTC
Testing a patch
Comment 7 Giovanni Bajo 2005-01-20 10:43:56 UTC
Patch here:
http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01305.html
Comment 8 CVS Commits 2005-01-21 02:27:22 UTC
Subject: Bug 19208

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	giovannibajo@gcc.gnu.org	2005-01-21 02:27:17

Modified files:
	gcc/cp         : ChangeLog pt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: array11.C 

Log message:
	PR c++/19208
	* pt.c (fold_decl_constant_value): Always call fold_non_dependent_expr
	at least once.
	(tsubst): Use fold_decl_constant_value in place of a bare call to
	integral_constant_value.
	
	PR c++/19208
	* g++.dg/template/array11.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4589&r2=1.4590
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.967&r2=1.968
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4916&r2=1.4917
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/array11.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 9 Giovanni Bajo 2005-01-21 02:29:13 UTC
Fixed in 4.0, the patch needs a little bit of tweaking for 3.4.
Comment 10 Paolo Bonzini 2005-01-24 08:29:59 UTC
Removing 4.0.0 from known-to-fail list.
Comment 11 Giovanni Bajo 2005-07-25 20:41:41 UTC
Patch posted for 3.4:
http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01653.html
Comment 13 Giovanni Bajo 2005-07-25 21:13:56 UTC
Fixed in GCC 3.4.5 too.