public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/38950]  New: ICE: deducing function template arguments for array type.
@ 2009-01-23 21:38 schaub-johannes at web dot de
  2009-01-30 15:27 ` [Bug c++/38950] [4.3/4.4 regression] " bangerth at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: schaub-johannes at web dot de @ 2009-01-23 21:38 UTC (permalink / raw)
  To: gcc-bugs

The following snippet makes GCC 4.3.2 (and SVN versions as of 09/2008 still)
cause an ICE:

template <typename T, T N> void f(T(&)[N]);

int main() {
    int x[2];
    unsigned int y[2];
    f(x); // works
    f(y); // ICE
}

Getting this output:

test.cpp: In function 'int main()':
test.cpp:7: internal compiler error: in dependent_type_p, at cp/pt.c:15585

More information about this issue:
http://stackoverflow.com/questions/472530/how-to-pass-an-array-size-as-a-template-with-template-type


-- 
           Summary: ICE: deducing function template arguments for array
                    type.
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schaub-johannes at web dot de
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38950


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/38950] [4.3/4.4 regression] ICE: deducing function template arguments for array type.
  2009-01-23 21:38 [Bug c++/38950] New: ICE: deducing function template arguments for array type schaub-johannes at web dot de
@ 2009-01-30 15:27 ` bangerth at gmail dot com
  2009-01-30 15:28 ` bangerth at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bangerth at gmail dot com @ 2009-01-30 15:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bangerth at gmail dot com  2009-01-30 15:27 -------
Confirmed. This used to work in 4.1 where we got the following error
(which does not earn the prize for the prettiest error message ever):

g/x> /home/bangerth/bin/gcc-4.1.1/bin/c++ -c x.cc
x.cc: In function 'int main()':
x.cc:7: error: size of array has non-integral type 'T'
x.cc:1: error: size of array has non-integral type 'T'
x.cc:1: error: size of array has non-integral type 'T'
x.cc:7: error: invalid initialization of reference of type 'unsigned int
(&)[1]' from expression of type 'unsigned int [2]'
x.cc:1: error: in passing argument 1 of 'void f(T (&)[N]) [with T = unsigned
int, T N = ((T)2)]'
x.cc: In function 'void f(T (&)[N]) [with T = unsigned int, T N = ((T)2)]':
x.cc:7:   instantiated from here
x.cc:1: error: size of array has non-integral type 'T'


-- 

bangerth at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-invalid-code
   Last reconfirmed|0000-00-00 00:00:00         |2009-01-30 15:27:16
               date|                            |
            Summary|ICE: deducing function      |[4.3/4.4 regression] ICE:
                   |template arguments for array|deducing function template
                   |type.                       |arguments for array type.


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38950


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/38950] [4.3/4.4 regression] ICE: deducing function template arguments for array type.
  2009-01-23 21:38 [Bug c++/38950] New: ICE: deducing function template arguments for array type schaub-johannes at web dot de
  2009-01-30 15:27 ` [Bug c++/38950] [4.3/4.4 regression] " bangerth at gmail dot com
@ 2009-01-30 15:28 ` bangerth at gmail dot com
  2009-02-01 13:25 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bangerth at gmail dot com @ 2009-01-30 15:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from bangerth at gmail dot com  2009-01-30 15:28 -------
Thinking some more about it, I believe that the code is actually valid.
icc accepts it, for comparison.

W.


-- 

bangerth at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-on-invalid-code         |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38950


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/38950] [4.3/4.4 regression] ICE: deducing function template arguments for array type.
  2009-01-23 21:38 [Bug c++/38950] New: ICE: deducing function template arguments for array type schaub-johannes at web dot de
  2009-01-30 15:27 ` [Bug c++/38950] [4.3/4.4 regression] " bangerth at gmail dot com
  2009-01-30 15:28 ` bangerth at gmail dot com
@ 2009-02-01 13:25 ` rguenth at gcc dot gnu dot org
  2009-02-03  2:03 ` schaub-johannes at web dot de
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-02-01 13:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2009-02-01 13:25 -------
3.3.6 and 3.4.1 accept it, starting with 3.4.2 we reject it and since 4.2.0 we
ICE.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code, rejects-
                   |                            |valid
      Known to fail|                            |3.4.2 4.2.0
      Known to work|                            |3.3.6 3.4.1
           Priority|P3                          |P2
   Target Milestone|---                         |4.3.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38950


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/38950] [4.3/4.4 regression] ICE: deducing function template arguments for array type.
  2009-01-23 21:38 [Bug c++/38950] New: ICE: deducing function template arguments for array type schaub-johannes at web dot de
                   ` (2 preceding siblings ...)
  2009-02-01 13:25 ` rguenth at gcc dot gnu dot org
@ 2009-02-03  2:03 ` schaub-johannes at web dot de
  2009-02-12 18:48 ` jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: schaub-johannes at web dot de @ 2009-02-03  2:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from schaub-johannes at web dot de  2009-02-03 02:02 -------
Yes, sorry for not mentioning it. I also think the code is valid. In the link
to stackoverflow.com, where i answered that guys question, i gave reasons why i
think so. Next time i will put what i think about that directly into the
bugreport :)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38950


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/38950] [4.3/4.4 regression] ICE: deducing function template arguments for array type.
  2009-01-23 21:38 [Bug c++/38950] New: ICE: deducing function template arguments for array type schaub-johannes at web dot de
                   ` (3 preceding siblings ...)
  2009-02-03  2:03 ` schaub-johannes at web dot de
@ 2009-02-12 18:48 ` jason at gcc dot gnu dot org
  2009-02-12 22:41 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-02-12 18:48 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-01-30 15:27:16         |2009-02-12 18:48:21
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38950


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/38950] [4.3/4.4 regression] ICE: deducing function template arguments for array type.
  2009-01-23 21:38 [Bug c++/38950] New: ICE: deducing function template arguments for array type schaub-johannes at web dot de
                   ` (4 preceding siblings ...)
  2009-02-12 18:48 ` jason at gcc dot gnu dot org
@ 2009-02-12 22:41 ` jason at gcc dot gnu dot org
  2009-02-17 18:27 ` jason at gcc dot gnu dot org
  2009-02-17 18:28 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-02-12 22:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jason at gcc dot gnu dot org  2009-02-12 22:40 -------
Subject: Bug 38950

Author: jason
Date: Thu Feb 12 22:40:37 2009
New Revision: 144139

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144139
Log:
        PR c++/38950
        * pt.c (unify)[TEMPLATE_PARM_INDEX]: Convert to the tsubsted type.

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


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38950


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/38950] [4.3/4.4 regression] ICE: deducing function template arguments for array type.
  2009-01-23 21:38 [Bug c++/38950] New: ICE: deducing function template arguments for array type schaub-johannes at web dot de
                   ` (5 preceding siblings ...)
  2009-02-12 22:41 ` jason at gcc dot gnu dot org
@ 2009-02-17 18:27 ` jason at gcc dot gnu dot org
  2009-02-17 18:28 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-02-17 18:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jason at gcc dot gnu dot org  2009-02-17 18:27 -------
Subject: Bug 38950

Author: jason
Date: Tue Feb 17 18:27:32 2009
New Revision: 144239

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144239
Log:
        PR c++/38950
        * pt.c (unify)[TEMPLATE_PARM_INDEX]: Convert to the tsubsted type.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/template/array20.C
      - copied unchanged from r144139,
trunk/gcc/testsuite/g++.dg/template/array20.C
Modified:
    branches/gcc-4_3-branch/gcc/cp/ChangeLog
    branches/gcc-4_3-branch/gcc/cp/pt.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38950


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/38950] [4.3/4.4 regression] ICE: deducing function template arguments for array type.
  2009-01-23 21:38 [Bug c++/38950] New: ICE: deducing function template arguments for array type schaub-johannes at web dot de
                   ` (6 preceding siblings ...)
  2009-02-17 18:27 ` jason at gcc dot gnu dot org
@ 2009-02-17 18:28 ` jason at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-02-17 18:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jason at gcc dot gnu dot org  2009-02-17 18:27 -------
Fixed.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38950


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-02-17 18:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-23 21:38 [Bug c++/38950] New: ICE: deducing function template arguments for array type schaub-johannes at web dot de
2009-01-30 15:27 ` [Bug c++/38950] [4.3/4.4 regression] " bangerth at gmail dot com
2009-01-30 15:28 ` bangerth at gmail dot com
2009-02-01 13:25 ` rguenth at gcc dot gnu dot org
2009-02-03  2:03 ` schaub-johannes at web dot de
2009-02-12 18:48 ` jason at gcc dot gnu dot org
2009-02-12 22:41 ` jason at gcc dot gnu dot org
2009-02-17 18:27 ` jason at gcc dot gnu dot org
2009-02-17 18:28 ` jason at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).