public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57887] New: nested non-type template parameters not declared in this scope
@ 2013-07-12 13:06 plasmahh at gmx dot net
  2013-08-18 13:08 ` [Bug c++/57887] " paolo.carlini at oracle dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: plasmahh at gmx dot net @ 2013-07-12 13:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57887
           Summary: nested non-type template parameters not declared in
                    this scope
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: plasmahh at gmx dot net

Hi, when trying to compile the following:

struct B
{
        template<int N>
        struct A
        {
                int X = N;
        };
};

I get the error: 
g.cxx:6:11: error: 'N' was not declared in this scope

Things work fine when I make X a static const(expr), or when I move A outside
B. The above code however works fine within clang, and I could not find any
wording that would make N suddenly not being available within A, especially
since when you add teh following member function to A (but remove X), it
compiles fine:

void foo( ) { int x = N; }

so it /somehow/ is in scope.


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

* [Bug c++/57887] nested non-type template parameters not declared in this scope
  2013-07-12 13:06 [Bug c++/57887] New: nested non-type template parameters not declared in this scope plasmahh at gmx dot net
@ 2013-08-18 13:08 ` paolo.carlini at oracle dot com
  2013-10-16 22:59 ` paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-18 13:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
*** Bug 58187 has been marked as a duplicate of this bug. ***


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

* [Bug c++/57887] nested non-type template parameters not declared in this scope
  2013-07-12 13:06 [Bug c++/57887] New: nested non-type template parameters not declared in this scope plasmahh at gmx dot net
  2013-08-18 13:08 ` [Bug c++/57887] " paolo.carlini at oracle dot com
@ 2013-10-16 22:59 ` paolo.carlini at oracle dot com
  2013-10-17 10:56 ` paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-16 22:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ville.voutilainen at gmail dot com

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
*** Bug 58760 has been marked as a duplicate of this bug. ***


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

* [Bug c++/57887] nested non-type template parameters not declared in this scope
  2013-07-12 13:06 [Bug c++/57887] New: nested non-type template parameters not declared in this scope plasmahh at gmx dot net
  2013-08-18 13:08 ` [Bug c++/57887] " paolo.carlini at oracle dot com
  2013-10-16 22:59 ` paolo.carlini at oracle dot com
@ 2013-10-17 10:56 ` paolo.carlini at oracle dot com
  2013-11-14  0:54 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-17 10:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This is accumulating duplicates.


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

* [Bug c++/57887] nested non-type template parameters not declared in this scope
  2013-07-12 13:06 [Bug c++/57887] New: nested non-type template parameters not declared in this scope plasmahh at gmx dot net
                   ` (2 preceding siblings ...)
  2013-10-17 10:56 ` paolo.carlini at oracle dot com
@ 2013-11-14  0:54 ` paolo.carlini at oracle dot com
  2013-11-14 20:17 ` paolo at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-11-14  0:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
   Target Milestone|---                         |4.9.0

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Seems doable: what is missing for "int X = N;" vs, eg, "void f(int = N);" is
the equivalent in cp_parser_class_specifier_1 of the wrapping

      /* Make sure that any template parameters are in scope.  */
      maybe_begin_member_template_processing (decl);
      /* Parse the default argument expressions.  */
      cp_parser_late_parsing_default_args (parser, decl);
      /* Remove any template parameters from the symbol table.  */
      maybe_end_member_template_processing ();

for the cp_parser_late_parsing_nsdmi call a few lines below.


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

* [Bug c++/57887] nested non-type template parameters not declared in this scope
  2013-07-12 13:06 [Bug c++/57887] New: nested non-type template parameters not declared in this scope plasmahh at gmx dot net
                   ` (3 preceding siblings ...)
  2013-11-14  0:54 ` paolo.carlini at oracle dot com
@ 2013-11-14 20:17 ` paolo at gcc dot gnu.org
  2013-11-14 20:18 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo at gcc dot gnu.org @ 2013-11-14 20:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Thu Nov 14 20:16:51 2013
New Revision: 204818

URL: http://gcc.gnu.org/viewcvs?rev=204818&root=gcc&view=rev
Log:
/cp
2013-11-14  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/57887
    * parser.c (cp_parser_late_parsing_nsdmi): Call
    maybe_begin_member_template_processing.
    * pt.c (maybe_begin_member_template_processing): Handle NSDMIs.
    (inline_needs_template_parms): Adjust.

/testsuite
2013-11-14  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/57887
    * g++.dg/cpp0x/nsdmi-template3.C: New.
    * g++.dg/cpp0x/nsdmi-template4.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-template3.C
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-template4.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/57887] nested non-type template parameters not declared in this scope
  2013-07-12 13:06 [Bug c++/57887] New: nested non-type template parameters not declared in this scope plasmahh at gmx dot net
                   ` (4 preceding siblings ...)
  2013-11-14 20:17 ` paolo at gcc dot gnu.org
@ 2013-11-14 20:18 ` paolo.carlini at oracle dot com
  2014-04-02  6:26 ` jaak at ristioja dot ee
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-11-14 20:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.9.0.


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

* [Bug c++/57887] nested non-type template parameters not declared in this scope
  2013-07-12 13:06 [Bug c++/57887] New: nested non-type template parameters not declared in this scope plasmahh at gmx dot net
                   ` (5 preceding siblings ...)
  2013-11-14 20:18 ` paolo.carlini at oracle dot com
@ 2014-04-02  6:26 ` jaak at ristioja dot ee
  2014-04-02  9:30 ` redi at gcc dot gnu.org
  2014-05-11 14:15 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: jaak at ristioja dot ee @ 2014-04-02  6:26 UTC (permalink / raw)
  To: gcc-bugs

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

Jaak Ristioja <jaak at ristioja dot ee> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jaak at ristioja dot ee

--- Comment #8 from Jaak Ristioja <jaak at ristioja dot ee> ---
As a result of a discussion on IRC (#gcc @ OTFC) we came to the conclusion that
GCC parsing of the following code (compare with code in Comment #0) was also
probably fixed by 204818.

struct Outer {
  template <typename>
  struct Inner {
    enum Type { TYPE_1 };
    Type m_type = TYPE_1;
  };
};

Resulted in ICE in GCC 4.7.3 and "invalid use of incomplete type 'enum
Outer::Inner< <template-parameter-1-1> >::Type'" in GCC 4.8.2. It was confirmed
by user jwakely to parse with GCC 4.9.


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

* [Bug c++/57887] nested non-type template parameters not declared in this scope
  2013-07-12 13:06 [Bug c++/57887] New: nested non-type template parameters not declared in this scope plasmahh at gmx dot net
                   ` (6 preceding siblings ...)
  2014-04-02  6:26 ` jaak at ristioja dot ee
@ 2014-04-02  9:30 ` redi at gcc dot gnu.org
  2014-05-11 14:15 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2014-04-02  9:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jaak Ristioja from comment #8)
> also probably fixed by 204818.

It was definitely fixed by r204818.

I don't know what commit fixed the 4.7 ICE


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

* [Bug c++/57887] nested non-type template parameters not declared in this scope
  2013-07-12 13:06 [Bug c++/57887] New: nested non-type template parameters not declared in this scope plasmahh at gmx dot net
                   ` (7 preceding siblings ...)
  2014-04-02  9:30 ` redi at gcc dot gnu.org
@ 2014-05-11 14:15 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-11 14:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #10 from Paolo Carlini <paolo.carlini at oracle dot com> ---
*** Bug 59809 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2014-05-11 14:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-12 13:06 [Bug c++/57887] New: nested non-type template parameters not declared in this scope plasmahh at gmx dot net
2013-08-18 13:08 ` [Bug c++/57887] " paolo.carlini at oracle dot com
2013-10-16 22:59 ` paolo.carlini at oracle dot com
2013-10-17 10:56 ` paolo.carlini at oracle dot com
2013-11-14  0:54 ` paolo.carlini at oracle dot com
2013-11-14 20:17 ` paolo at gcc dot gnu.org
2013-11-14 20:18 ` paolo.carlini at oracle dot com
2014-04-02  6:26 ` jaak at ristioja dot ee
2014-04-02  9:30 ` redi at gcc dot gnu.org
2014-05-11 14:15 ` 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).