public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53531] New: <,,,,> accepted as template arguments for variadic template
@ 2012-05-30 16:29 redi at gcc dot gnu.org
  2012-07-10 10:37 ` [Bug c++/53531] " niels at penneman dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2012-05-30 16:29 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53531
           Summary: <,,,,> accepted as template arguments for variadic
                    template
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: redi@gcc.gnu.org


template <typename ...> struct S;

int i = S<,,,,>::undefined;


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

* [Bug c++/53531] <,,,,> accepted as template arguments for variadic template
  2012-05-30 16:29 [Bug c++/53531] New: <,,,,> accepted as template arguments for variadic template redi at gcc dot gnu.org
@ 2012-07-10 10:37 ` niels at penneman dot org
  2012-07-10 11:01 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: niels at penneman dot org @ 2012-07-10 10:37 UTC (permalink / raw)
  To: gcc-bugs

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

Niels Penneman <niels at penneman dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |niels at penneman dot org

--- Comment #1 from Niels Penneman <niels at penneman dot org> 2012-07-10 10:37:34 UTC ---
Exactly the same behavior with both 4.6.3 and 4.7.1

Similar test case below. Adding a trailing comma to a list of template
arguments breaks the code but compiles successfully and without warnings. A
trailing comma in a template list of for instance boost::mpl::vector will make
the vector "empty".

#########################
template <typename ... Ts>
struct S;

template <typename T, typename ... Ts>
struct S<T, Ts ...> { static constexpr int count = S<Ts ...>::count + 1; };

template <typename T>
struct S<T>         { static constexpr int count = 1; };

int main()
{
  return S<char, int, long,>::count;
}
#########################
$ g++ -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3/g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.3/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.6.3/work/gcc-4.6.3/configure
--prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --with-ppl --with-cloog --disable-ppl-version-check
--with-cloog-include=/usr/include/cloog-ppl --enable-lto --enable-nls
--without-included-gettext --with-system-zlib --enable-obsolete
--disable-werror --enable-secureplt --enable-multilib --disable-libmudflap
--disable-libssp --enable-libgomp
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/python
--enable-checking=release --disable-libgcj --disable-libquadmath
--enable-languages=c,c++ --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all
--with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.6.3 p1.3,
pie-0.5.2'
Thread model: posix
gcc version 4.6.3 (Gentoo 4.6.3 p1.3, pie-0.5.2) 

$ g++ -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.1/g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.7.1/work/gcc-4.7.1/configure
--prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.1
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.1
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.1/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.1/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --with-ppl --with-cloog --disable-ppl-version-check
--with-cloog-include=/usr/include/cloog-ppl --enable-lto --enable-nls
--without-included-gettext --with-system-zlib --enable-obsolete
--disable-werror --enable-secureplt --enable-multilib
--with-multilib-list=m32,m64 --disable-libmudflap --disable-libssp
--enable-libgomp
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.7.1/python
--enable-checking=release --disable-libgcj --disable-libquadmath
--enable-languages=c,c++ --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all
--with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.7.1 p1.0,
pie-0.5.3'
Thread model: posix
gcc version 4.7.1 (Gentoo 4.7.1 p1.0, pie-0.5.3) 
#########################

Command: g++ -Wall -Wextra -std=c++0x undef.cpp
Output: none, completes succesfully

Command: ./a.out ; echo $?
Output: 0

When omitting the trailing comma, return status of compiled application is 3 as
expected.


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

* [Bug c++/53531] <,,,,> accepted as template arguments for variadic template
  2012-05-30 16:29 [Bug c++/53531] New: <,,,,> accepted as template arguments for variadic template redi at gcc dot gnu.org
  2012-07-10 10:37 ` [Bug c++/53531] " niels at penneman dot org
@ 2012-07-10 11:01 ` redi at gcc dot gnu.org
  2012-07-10 12:58 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2012-07-10 11:01 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-07-10 11:01:40 UTC ---
It's now rejected on trunk:

c.cc:3:15: error: template argument 1 is invalid
 int i = S<,,,,>::undefined;
               ^
c.cc:3:15: error: template argument 2 is invalid
c.cc:3:15: error: template argument 3 is invalid
c.cc:3:15: error: template argument 4 is invalid
c.cc:3:15: error: template argument 5 is invalid

(I might have been using an older 4.8 snapshot when I reported the bug, not
sure now.)

Jason, any idea which patch fixed these cases and if we need anything in the
testsuite to prevent regressions before closing it?


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

* [Bug c++/53531] <,,,,> accepted as template arguments for variadic template
  2012-05-30 16:29 [Bug c++/53531] New: <,,,,> accepted as template arguments for variadic template redi at gcc dot gnu.org
  2012-07-10 10:37 ` [Bug c++/53531] " niels at penneman dot org
  2012-07-10 11:01 ` redi at gcc dot gnu.org
@ 2012-07-10 12:58 ` jason at gcc dot gnu.org
  2012-07-10 13:03 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2012-07-10 12:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2012-07-10 12:58:25 UTC ---
(In reply to comment #2)
> Jason, any idea which patch fixed these cases and if we need anything in the
> testsuite to prevent regressions before closing it?

Nothing springs to mind.  grep ,, variadic* doesn't get any hits, so adding a
testcase wouldn't hurt.


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

* [Bug c++/53531] <,,,,> accepted as template arguments for variadic template
  2012-05-30 16:29 [Bug c++/53531] New: <,,,,> accepted as template arguments for variadic template redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-07-10 12:58 ` jason at gcc dot gnu.org
@ 2012-07-10 13:03 ` redi at gcc dot gnu.org
  2012-07-13  7:53 ` redi at gcc dot gnu.org
  2012-07-13  7:55 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2012-07-10 13:03 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-07-10
         AssignedTo|unassigned at gcc dot       |redi at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-07-10 13:03:09 UTC ---
OK, thanks, I'll do that.

I tried reverting the patch for PR 47220 but that wasn't it, and I didn't look
any further.


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

* [Bug c++/53531] <,,,,> accepted as template arguments for variadic template
  2012-05-30 16:29 [Bug c++/53531] New: <,,,,> accepted as template arguments for variadic template redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-07-10 13:03 ` redi at gcc dot gnu.org
@ 2012-07-13  7:53 ` redi at gcc dot gnu.org
  2012-07-13  7:55 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2012-07-13  7:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-07-13 07:53:21 UTC ---
Author: redi
Date: Fri Jul 13 07:53:12 2012
New Revision: 189452

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189452
Log:
    PR c++/53531
    * testsuite/g++.dg/cpp0x/variadic135.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/variadic135.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/53531] <,,,,> accepted as template arguments for variadic template
  2012-05-30 16:29 [Bug c++/53531] New: <,,,,> accepted as template arguments for variadic template redi at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-07-13  7:53 ` redi at gcc dot gnu.org
@ 2012-07-13  7:55 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2012-07-13  7:55 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.8.0
      Known to fail|                            |4.6.3, 4.7.1

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-07-13 07:54:37 UTC ---
Fixed on trunk


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

end of thread, other threads:[~2012-07-13  7:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-30 16:29 [Bug c++/53531] New: <,,,,> accepted as template arguments for variadic template redi at gcc dot gnu.org
2012-07-10 10:37 ` [Bug c++/53531] " niels at penneman dot org
2012-07-10 11:01 ` redi at gcc dot gnu.org
2012-07-10 12:58 ` jason at gcc dot gnu.org
2012-07-10 13:03 ` redi at gcc dot gnu.org
2012-07-13  7:53 ` redi at gcc dot gnu.org
2012-07-13  7:55 ` redi 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).