public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53836] New: ICE: unexpected expression of kind template_parm_index
@ 2012-07-03  8:23 roger.ferrer at bsc dot es
  2012-07-03  8:29 ` [Bug c++/53836] " roger.ferrer at bsc dot es
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: roger.ferrer at bsc dot es @ 2012-07-03  8:23 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53836
           Summary: ICE: unexpected expression of kind template_parm_index
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: roger.ferrer@bsc.es


Created attachment 27733
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27733
Preprocessed source

Hello,

the following testcase fails to compile in g++ 4.7.1

// -- test.cc
template <int N>
struct A { };

template <int Q>
void g()
{
    const int M ( Q );

    A<M> a;
}

void h()
{
    g<3>();
}

$ g++ -c test.cc
test.cc: In function ‘void g()’:
test.cc:9:8: internal compiler error: unexpected expression ‘Q’ of kind
template_parm_index
Please submit a full bug report,
with preprocessed source if appropriate.
Preprocessed source stored into /tmp/cc7IeEc0.out file, please attach this to
your bugreport.

Using 'const int M = Q;' instead works fine.

g++ 4.4 and g++ 4.5 fail (without an ICE), but g++ 4.6.3 works fine so it looks
to me as a 4.7 regression.

Kind regards,


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

* [Bug c++/53836] ICE: unexpected expression of kind template_parm_index
  2012-07-03  8:23 [Bug c++/53836] New: ICE: unexpected expression of kind template_parm_index roger.ferrer at bsc dot es
@ 2012-07-03  8:29 ` roger.ferrer at bsc dot es
  2012-07-03 17:27 ` daniel.kruegler at googlemail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: roger.ferrer at bsc dot es @ 2012-07-03  8:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Roger Ferrer Ibanez <roger.ferrer at bsc dot es> 2012-07-03 08:28:59 UTC ---
A similar problem happens when template-type parameters are involved.

// -- test2.cc
template <int N>
struct A { };

template <typename Q>
void g2()
{
    const int M  ( sizeof(Q) );
    A<M> a;
}

void h()
{
    g2<int>();
}

$ g++ -c test2.cc
test2.cc: In function ‘void g2()’:
test2.cc:8:8: error: the value of ‘M’ is not usable in a constant expression
test2.cc:7:15: note: ‘M’ was not initialized with a constant expression
test2.cc:8:8: note: in template argument for type ‘int’ 
test2.cc:8:11: error: invalid type in declaration before ‘;’ token

Should I open another PR for that one?


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

* [Bug c++/53836] ICE: unexpected expression of kind template_parm_index
  2012-07-03  8:23 [Bug c++/53836] New: ICE: unexpected expression of kind template_parm_index roger.ferrer at bsc dot es
  2012-07-03  8:29 ` [Bug c++/53836] " roger.ferrer at bsc dot es
@ 2012-07-03 17:27 ` daniel.kruegler at googlemail dot com
  2012-08-13 15:27 ` [Bug c++/53836] [4.7/4.8 Regression] " paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-07-03 17:27 UTC (permalink / raw)
  To: gcc-bugs

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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #2 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-07-03 17:27:32 UTC ---
The problem persist in gcc 4.8.0 20120624 (experimental), even though the error
message is different (and no ICE anymore):

  |In function 'void g()':|
 9|error: '(const int)Q' is not a constant expression|
 9|note: in template argument for type 'int' |
 9|error: invalid type in declaration before ';' token|
14|  required from here|
 9|warning: unused variable 'a' [-Wunused-variable]|

The original code should be accepted.


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

* [Bug c++/53836] [4.7/4.8 Regression] ICE: unexpected expression of kind template_parm_index
  2012-07-03  8:23 [Bug c++/53836] New: ICE: unexpected expression of kind template_parm_index roger.ferrer at bsc dot es
  2012-07-03  8:29 ` [Bug c++/53836] " roger.ferrer at bsc dot es
  2012-07-03 17:27 ` daniel.kruegler at googlemail dot com
@ 2012-08-13 15:27 ` paolo.carlini at oracle dot com
  2012-08-13 21:07 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-13 15:27 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-08-13
                 CC|                            |hjl.tools at gmail dot com
            Summary|ICE: unexpected expression  |[4.7/4.8 Regression] ICE:
                   |of kind template_parm_index |unexpected expression of
                   |                            |kind template_parm_index
     Ever Confirmed|0                           |1

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-13 15:26:57 UTC ---
Mainline ICEs for me (190348) and indeed looks like a regression.

HJ, can you help figuring out when we regressed?


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

* [Bug c++/53836] [4.7/4.8 Regression] ICE: unexpected expression of kind template_parm_index
  2012-07-03  8:23 [Bug c++/53836] New: ICE: unexpected expression of kind template_parm_index roger.ferrer at bsc dot es
                   ` (2 preceding siblings ...)
  2012-08-13 15:27 ` [Bug c++/53836] [4.7/4.8 Regression] " paolo.carlini at oracle dot com
@ 2012-08-13 21:07 ` hjl.tools at gmail dot com
  2012-09-07  9:23 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2012-08-13 21:07 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at redhat dot com

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> 2012-08-13 21:07:04 UTC ---
It was fixed by revision 172942:

http://gcc.gnu.org/ml/gcc-cvs/2011-04/msg01138.html

on 4.6 branch.  However, the same patch was never applied
on trunk.


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

* [Bug c++/53836] [4.7/4.8 Regression] ICE: unexpected expression of kind template_parm_index
  2012-07-03  8:23 [Bug c++/53836] New: ICE: unexpected expression of kind template_parm_index roger.ferrer at bsc dot es
                   ` (3 preceding siblings ...)
  2012-08-13 21:07 ` hjl.tools at gmail dot com
@ 2012-09-07  9:23 ` rguenth at gcc dot gnu.org
  2012-09-13 15:14 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-07  9:23 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.2
           Keywords|                            |rejects-valid
           Priority|P3                          |P2
      Known to work|                            |4.6.3
            Version|unknown                     |4.7.1


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

* [Bug c++/53836] [4.7/4.8 Regression] ICE: unexpected expression of kind template_parm_index
  2012-07-03  8:23 [Bug c++/53836] New: ICE: unexpected expression of kind template_parm_index roger.ferrer at bsc dot es
                   ` (4 preceding siblings ...)
  2012-09-07  9:23 ` rguenth at gcc dot gnu.org
@ 2012-09-13 15:14 ` jason at gcc dot gnu.org
  2012-09-13 15:15 ` jason at gcc dot gnu.org
  2012-09-13 15:31 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2012-09-13 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-13 15:13:40 UTC ---
Author: jason
Date: Thu Sep 13 15:13:24 2012
New Revision: 191261

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191261
Log:
    PR c++/53836
    * pt.c (value_dependent_expression_p): A TREE_LIST initializer must
    be dependent.

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


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

* [Bug c++/53836] [4.7/4.8 Regression] ICE: unexpected expression of kind template_parm_index
  2012-07-03  8:23 [Bug c++/53836] New: ICE: unexpected expression of kind template_parm_index roger.ferrer at bsc dot es
                   ` (5 preceding siblings ...)
  2012-09-13 15:14 ` jason at gcc dot gnu.org
@ 2012-09-13 15:15 ` jason at gcc dot gnu.org
  2012-09-13 15:31 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2012-09-13 15:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-13 15:13:40 UTC ---
Author: jason
Date: Thu Sep 13 15:13:24 2012
New Revision: 191261

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191261
Log:
    PR c++/53836
    * pt.c (value_dependent_expression_p): A TREE_LIST initializer must
    be dependent.

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

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-13 15:14:41 UTC ---
Author: jason
Date: Thu Sep 13 15:14:27 2012
New Revision: 191264

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191264
Log:
    PR c++/53836
    * pt.c (value_dependent_expression_p): A TREE_LIST initializer must
    be dependent.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/template/init10.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/pt.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug c++/53836] [4.7/4.8 Regression] ICE: unexpected expression of kind template_parm_index
  2012-07-03  8:23 [Bug c++/53836] New: ICE: unexpected expression of kind template_parm_index roger.ferrer at bsc dot es
                   ` (6 preceding siblings ...)
  2012-09-13 15:15 ` jason at gcc dot gnu.org
@ 2012-09-13 15:31 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2012-09-13 15:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|                            |FIXED

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-13 15:13:40 UTC ---
Author: jason
Date: Thu Sep 13 15:13:24 2012
New Revision: 191261

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191261
Log:
    PR c++/53836
    * pt.c (value_dependent_expression_p): A TREE_LIST initializer must
    be dependent.

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

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-13 15:14:41 UTC ---
Author: jason
Date: Thu Sep 13 15:14:27 2012
New Revision: 191264

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191264
Log:
    PR c++/53836
    * pt.c (value_dependent_expression_p): A TREE_LIST initializer must
    be dependent.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/template/init10.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/pt.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-13 15:30:24 UTC ---
Fixed for 4.7.2.


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

end of thread, other threads:[~2012-09-13 15:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-03  8:23 [Bug c++/53836] New: ICE: unexpected expression of kind template_parm_index roger.ferrer at bsc dot es
2012-07-03  8:29 ` [Bug c++/53836] " roger.ferrer at bsc dot es
2012-07-03 17:27 ` daniel.kruegler at googlemail dot com
2012-08-13 15:27 ` [Bug c++/53836] [4.7/4.8 Regression] " paolo.carlini at oracle dot com
2012-08-13 21:07 ` hjl.tools at gmail dot com
2012-09-07  9:23 ` rguenth at gcc dot gnu.org
2012-09-13 15:14 ` jason at gcc dot gnu.org
2012-09-13 15:15 ` jason at gcc dot gnu.org
2012-09-13 15:31 ` jason at gcc dot gnu.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).