public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers
@ 2012-03-15 18:53 jeremy at jeremyms dot com
  2012-03-15 18:58 ` [Bug c++/52595] " pinskia at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: jeremy at jeremyms dot com @ 2012-03-15 18:53 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52595
           Summary: Incorrect parsing of commas in non-static data member
                    initializers
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jeremy@jeremyms.com


With this example:

---

template <class T, int N>
struct A {
  static int foo();
};


template <class T, int N>
struct B {
  int var = A<T,N>::foo();
};

---

Compiled with -std=gnu++11, g++ gives the following error:

test.cpp:9:17: error: expected ';' at end of member declaration
test.cpp:9:17: error: declaration of 'int B<T, N>::N'
test.cpp:7:20: error:  shadows template parm 'int N'
test.cpp:9:18: error: expected unqualified-id before '>' token
test.cpp:9:15: error: wrong number of template arguments (1, should be 2)
test.cpp:2:8: error: provided for 'template<class T, int N> struct A'

Surrounding the initializer in parentheses, i.e.

  int var = (A<T,N>::foo());

fixes the error.  This error also does not happen for static data members.

It appears that g++ is not properly parsing the comma inside the template
argument list.

COLLECT_GCC=g++-4.7.0-pre9999
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.0-pre9999/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.7.0_pre9999/work/gcc-4.7.0-9999/configure
--prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.0-pre9999
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0-pre9999/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.0-pre9999
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.0-pre9999/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.0-pre9999/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.0-pre9999/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --without-ppl --without-cloog --enable-lto --disable-nls
--with-system-zlib --disable-werror --enable-secureplt --enable-multilib
--with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp
--enable-libgomp
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.7.0-pre9999/python
--enable-checking=release --disable-libgcj --enable-languages=c,c++,fortran
--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.0_pre9999'
Thread model: posix
gcc version 4.7.0-pre9999 20120314 (prerelease) commit
fe9f13b8d6563daf45c0ed10da40ec2c05473a11 (Gentoo 4.7.0_pre9999)


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

* [Bug c++/52595] Incorrect parsing of commas in non-static data member initializers
  2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
@ 2012-03-15 18:58 ` pinskia at gcc dot gnu.org
  2012-03-15 19:25 ` [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix pinskia at gcc dot gnu.org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-15 18:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-15 18:53:00 UTC ---
See C++ defect report 325, it says it applies to NSDMI also.


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

* [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix
  2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
  2012-03-15 18:58 ` [Bug c++/52595] " pinskia at gcc dot gnu.org
@ 2012-03-15 19:25 ` pinskia at gcc dot gnu.org
  2012-03-20 11:35 ` paolo.carlini at oracle dot com
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-15 19:25 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |SUSPENDED
   Last reconfirmed|                            |2012-03-15
            Summary|Incorrect parsing of commas |[DR 325] commas and
                   |in non-static data member   |non-static data member
                   |initializers                |initializers don't mix
     Ever Confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-15 18:56:36 UTC ---
http://open-std.org/JTC1/SC22/WG21/docs/cwg_active.html#325 for future
reference.


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

* [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix
  2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
  2012-03-15 18:58 ` [Bug c++/52595] " pinskia at gcc dot gnu.org
  2012-03-15 19:25 ` [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix pinskia at gcc dot gnu.org
@ 2012-03-20 11:35 ` paolo.carlini at oracle dot com
  2012-03-20 23:45 ` pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-03-20 11:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-03-20 11:29:49 UTC ---
I'm a bit confused here. If this is Core/325 should be duplicate of PR51666,
right? But, maybe too quickly, I closed the latter as fixed upon Jason commit
(see also http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00062.html).

So, what's going on? Was the commit for PR51666 incomplete, so to speak?


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

* [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix
  2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
                   ` (2 preceding siblings ...)
  2012-03-20 11:35 ` paolo.carlini at oracle dot com
@ 2012-03-20 23:45 ` pinskia at gcc dot gnu.org
  2014-05-23 11:09 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-20 23:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-20 23:00:19 UTC ---
(In reply to comment #3)
> So, what's going on? Was the commit for PR51666 incomplete, so to speak?

Maybe it was incomplete but then again the Defect report is still open though
there has been some changes to the dr about the change and such.


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

* [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix
  2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
                   ` (3 preceding siblings ...)
  2012-03-20 23:45 ` pinskia at gcc dot gnu.org
@ 2014-05-23 11:09 ` redi at gcc dot gnu.org
  2014-07-04  8:29 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2014-05-23 11:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52595

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tower120 at gmail dot com

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 61290 has been marked as a duplicate of this bug. ***


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

* [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix
  2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
                   ` (4 preceding siblings ...)
  2014-05-23 11:09 ` redi at gcc dot gnu.org
@ 2014-07-04  8:29 ` redi at gcc dot gnu.org
  2015-02-18 19:30 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2014-07-04  8:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52595

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |siim.schults at gmail dot com

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 61690 has been marked as a duplicate of this bug. ***


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

* [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix
  2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
                   ` (5 preceding siblings ...)
  2014-07-04  8:29 ` redi at gcc dot gnu.org
@ 2015-02-18 19:30 ` redi at gcc dot gnu.org
  2015-03-22 16:17 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2015-02-18 19:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52595

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stanshebs at earthlink dot net

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 65110 has been marked as a duplicate of this bug. ***


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

* [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix
  2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
                   ` (6 preceding siblings ...)
  2015-02-18 19:30 ` redi at gcc dot gnu.org
@ 2015-03-22 16:17 ` redi at gcc dot gnu.org
  2015-05-27 23:05 ` nathan at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-22 16:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52595

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nilschrbrause at googlemail dot co
                   |                            |m

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 65514 has been marked as a duplicate of this bug. ***


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

* [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix
  2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
                   ` (7 preceding siblings ...)
  2015-03-22 16:17 ` redi at gcc dot gnu.org
@ 2015-05-27 23:05 ` nathan at gcc dot gnu.org
  2015-05-30 16:04 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: nathan at gcc dot gnu.org @ 2015-05-27 23:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52595

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |ASSIGNED
                 CC|                            |nathan at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |nathan at gcc dot gnu.org


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

* [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix
  2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
                   ` (8 preceding siblings ...)
  2015-05-27 23:05 ` nathan at gcc dot gnu.org
@ 2015-05-30 16:04 ` redi at gcc dot gnu.org
  2015-06-05 13:36 ` nathan at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2015-05-30 16:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52595

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |barry.revzin at gmail dot com

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 66344 has been marked as a duplicate of this bug. ***


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

* [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix
  2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
                   ` (9 preceding siblings ...)
  2015-05-30 16:04 ` redi at gcc dot gnu.org
@ 2015-06-05 13:36 ` nathan at gcc dot gnu.org
  2015-06-05 14:16 ` nathan at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: nathan at gcc dot gnu.org @ 2015-06-05 13:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52595

--- Comment #10 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
Author: nathan
Date: Fri Jun  5 13:35:30 2015
New Revision: 224152

URL: https://gcc.gnu.org/viewcvs?rev=224152&root=gcc&view=rev
Log:
        cp/
        PR c++/52595
        * parser.c (cp_parser_cache_defarg): Continue looking for
        declarators when scanning a potential template argument list of an
        NSDMI.

        testsuite/
        PR c++/52595
        * g++,dg/cpp0x/nsdmi-defer5.C: Add template case.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-defer5.C


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

* [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix
  2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
                   ` (10 preceding siblings ...)
  2015-06-05 13:36 ` nathan at gcc dot gnu.org
@ 2015-06-05 14:16 ` nathan at gcc dot gnu.org
  2015-07-21 18:19 ` redi at gcc dot gnu.org
  2015-07-21 18:20 ` redi at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: nathan at gcc dot gnu.org @ 2015-06-05 14:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52595

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

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

--- Comment #11 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
patch committed

https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02582.html


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

* [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix
  2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
                   ` (11 preceding siblings ...)
  2015-06-05 14:16 ` nathan at gcc dot gnu.org
@ 2015-07-21 18:19 ` redi at gcc dot gnu.org
  2015-07-21 18:20 ` redi at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2015-07-21 18:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52595

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |6.0


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

* [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix
  2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
                   ` (12 preceding siblings ...)
  2015-07-21 18:19 ` redi at gcc dot gnu.org
@ 2015-07-21 18:20 ` redi at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2015-07-21 18:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52595

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |akhripin at bostondynamics dot com

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 66961 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2015-07-21 18:20 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-15 18:53 [Bug c++/52595] New: Incorrect parsing of commas in non-static data member initializers jeremy at jeremyms dot com
2012-03-15 18:58 ` [Bug c++/52595] " pinskia at gcc dot gnu.org
2012-03-15 19:25 ` [Bug c++/52595] [DR 325] commas and non-static data member initializers don't mix pinskia at gcc dot gnu.org
2012-03-20 11:35 ` paolo.carlini at oracle dot com
2012-03-20 23:45 ` pinskia at gcc dot gnu.org
2014-05-23 11:09 ` redi at gcc dot gnu.org
2014-07-04  8:29 ` redi at gcc dot gnu.org
2015-02-18 19:30 ` redi at gcc dot gnu.org
2015-03-22 16:17 ` redi at gcc dot gnu.org
2015-05-27 23:05 ` nathan at gcc dot gnu.org
2015-05-30 16:04 ` redi at gcc dot gnu.org
2015-06-05 13:36 ` nathan at gcc dot gnu.org
2015-06-05 14:16 ` nathan at gcc dot gnu.org
2015-07-21 18:19 ` redi at gcc dot gnu.org
2015-07-21 18:20 ` 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).