public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55494] New: ICE for char array or int in variadic template
@ 2012-11-27 18:45 jondreads at gmail dot com
  2012-11-27 18:50 ` [Bug c++/55494] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jondreads at gmail dot com @ 2012-11-27 18:45 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55494
           Summary: ICE for char array or int in variadic template
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jondreads@gmail.com


The following code generates internal compiler error: in unify_one_argument, at
cp/pt.c:15267
The error is generated if the template argument to Foo is a char array or int.
It is not generated if it is a struct.

gcc version 4.7.2.20120921 (Red Hat 4.7.2-2)
Target: x86_64-redhat-linux



struct S {};

template <char const * Name>
struct Foo {};

template <typename...Args>
void operator<<(S& os, Foo<Args...>& m)
{
}

char test[] = "test";

int main()
{
    S s;
    Foo<test> m;
    s << m;
}


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

* [Bug c++/55494] ICE for char array or int in variadic template
  2012-11-27 18:45 [Bug c++/55494] New: ICE for char array or int in variadic template jondreads at gmail dot com
@ 2012-11-27 18:50 ` mpolacek at gcc dot gnu.org
  2012-11-27 18:55 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2012-11-27 18:50 UTC (permalink / raw)
  To: gcc-bugs


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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-11-27
                 CC|                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.8.0
     Ever Confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> 2012-11-27 18:49:34 UTC ---
Reproduced with trunk.


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

* [Bug c++/55494] ICE for char array or int in variadic template
  2012-11-27 18:45 [Bug c++/55494] New: ICE for char array or int in variadic template jondreads at gmail dot com
  2012-11-27 18:50 ` [Bug c++/55494] " mpolacek at gcc dot gnu.org
@ 2012-11-27 18:55 ` mpolacek at gcc dot gnu.org
  2012-11-28 12:38 ` rguenth at gcc dot gnu.org
  2012-11-28 17:40 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2012-11-27 18:55 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> 2012-11-27 18:55:34 UTC ---
ICEs even with 4.7 branch.  With 4.6:

/home/marek/rh/tests/pr55494.C:6:19: warning: variadic templates only available
with -std=c++0x or -std=gnu++0x [enabled by default]
/home/marek/rh/tests/pr55494.C:7:35: sorry, unimplemented: cannot expand ‘Args
...’ into a fixed-length argument list
/home/marek/rh/tests/pr55494.C:7:35: error: type/value mismatch at argument 1
in template parameter list for ‘template<const char* Name> struct Foo’
/home/marek/rh/tests/pr55494.C:7:35: error:   expected a constant of type
‘const char*’, got ‘Args ...’
/home/marek/rh/tests/pr55494.C: In function ‘int main()’:
/home/marek/rh/tests/pr55494.C:17:10: error: no match for ‘operator<<’ in ‘s <<
m’
/home/marek/rh/tests/pr55494.C:17:10: note: candidate is:
/home/marek/rh/tests/pr55494.C:7:6: note: template<class ... Args> void
operator<<(S&, int&)


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

* [Bug c++/55494] ICE for char array or int in variadic template
  2012-11-27 18:45 [Bug c++/55494] New: ICE for char array or int in variadic template jondreads at gmail dot com
  2012-11-27 18:50 ` [Bug c++/55494] " mpolacek at gcc dot gnu.org
  2012-11-27 18:55 ` mpolacek at gcc dot gnu.org
@ 2012-11-28 12:38 ` rguenth at gcc dot gnu.org
  2012-11-28 17:40 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-11-28 12:38 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
   Target Milestone|4.8.0                       |---


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

* [Bug c++/55494] ICE for char array or int in variadic template
  2012-11-27 18:45 [Bug c++/55494] New: ICE for char array or int in variadic template jondreads at gmail dot com
                   ` (2 preceding siblings ...)
  2012-11-28 12:38 ` rguenth at gcc dot gnu.org
@ 2012-11-28 17:40 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-28 17:40 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-28 17:39:32 UTC ---
This is invalid and essentially equivalent to PR52844: operator<< takes as m a
Foo which is a (variadic) type template, but the Foo we are defining is a
non-type template. Note that when there are no variadic templates around these
testcases are simply rejected.

*** This bug has been marked as a duplicate of bug 52844 ***


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

end of thread, other threads:[~2012-11-28 17:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-27 18:45 [Bug c++/55494] New: ICE for char array or int in variadic template jondreads at gmail dot com
2012-11-27 18:50 ` [Bug c++/55494] " mpolacek at gcc dot gnu.org
2012-11-27 18:55 ` mpolacek at gcc dot gnu.org
2012-11-28 12:38 ` rguenth at gcc dot gnu.org
2012-11-28 17:40 ` paolo.carlini at oracle dot com

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).