public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60842] New: In-class initializer causes a strange error
@ 2014-04-14 17:35 kariya_mitsuru at hotmail dot com
  2014-04-14 19:01 ` [Bug c++/60842] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: kariya_mitsuru at hotmail dot com @ 2014-04-14 17:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60842
           Summary: In-class initializer causes a strange error
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kariya_mitsuru at hotmail dot com

The sample code below causes a strange error.

=========================== source code ===========================
namespace N {
    class I {};
}

template <typename, typename>
class J {};

class S {
    J<int, N::I> j = J<int, N::I>{};
};

int main() {}
=========================== source code ===========================

========================== error messages ==========================
prog.cc:9:32: error: invalid use of '::'
     J<int, N::I> j = J<int, N::I>{};
                                ^
prog.cc:9:32: error: expected ';' at end of member declaration
prog.cc:9:33: error: expected unqualified-id before '>' token
     J<int, N::I> j = J<int, N::I>{};
                                 ^
prog.cc:9:24: error: wrong number of template arguments (1, should be 2)
     J<int, N::I> j = J<int, N::I>{};
                        ^
prog.cc:6:7: error: provided for 'template<class, class> class J'
 class J {};
       ^
========================== error messages ==========================

I think that the sample code should be compiled successfully.

cf. http://melpon.org/wandbox/permlink/h96WGv3EW3DOyHnB


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

* [Bug c++/60842] In-class initializer causes a strange error
  2014-04-14 17:35 [Bug c++/60842] New: In-class initializer causes a strange error kariya_mitsuru at hotmail dot com
@ 2014-04-14 19:01 ` redi at gcc dot gnu.org
  2014-04-14 19:02 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-04-14 19:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This looks very similar to PR51666


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

* [Bug c++/60842] In-class initializer causes a strange error
  2014-04-14 17:35 [Bug c++/60842] New: In-class initializer causes a strange error kariya_mitsuru at hotmail dot com
  2014-04-14 19:01 ` [Bug c++/60842] " redi at gcc dot gnu.org
@ 2014-04-14 19:02 ` redi at gcc dot gnu.org
  2014-12-14 15:39 ` ville.voutilainen at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-04-14 19:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
N.B. the simplest workaround is:

    J<int, N::I> j{};


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

* [Bug c++/60842] In-class initializer causes a strange error
  2014-04-14 17:35 [Bug c++/60842] New: In-class initializer causes a strange error kariya_mitsuru at hotmail dot com
  2014-04-14 19:01 ` [Bug c++/60842] " redi at gcc dot gnu.org
  2014-04-14 19:02 ` redi at gcc dot gnu.org
@ 2014-12-14 15:39 ` ville.voutilainen at gmail dot com
  2015-07-10 14:35 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14 15:39 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-14
                 CC|                            |ville.voutilainen at gmail dot com
     Ever confirmed|0                           |1
      Known to fail|                            |4.8.2, 4.9.1, 5.0

--- Comment #3 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Clang accepts the code.


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

* [Bug c++/60842] In-class initializer causes a strange error
  2014-04-14 17:35 [Bug c++/60842] New: In-class initializer causes a strange error kariya_mitsuru at hotmail dot com
                   ` (2 preceding siblings ...)
  2014-12-14 15:39 ` ville.voutilainen at gmail dot com
@ 2015-07-10 14:35 ` paolo.carlini at oracle dot com
  2015-07-10 14:45 ` paolo at gcc dot gnu.org
  2015-07-10 14:45 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-07-10 14:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This is fixed in mainline. I'm adding the testcase and closing the bug.


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

* [Bug c++/60842] In-class initializer causes a strange error
  2014-04-14 17:35 [Bug c++/60842] New: In-class initializer causes a strange error kariya_mitsuru at hotmail dot com
                   ` (4 preceding siblings ...)
  2015-07-10 14:45 ` paolo at gcc dot gnu.org
@ 2015-07-10 14:45 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-07-10 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |6.0

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.


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

* [Bug c++/60842] In-class initializer causes a strange error
  2014-04-14 17:35 [Bug c++/60842] New: In-class initializer causes a strange error kariya_mitsuru at hotmail dot com
                   ` (3 preceding siblings ...)
  2015-07-10 14:35 ` paolo.carlini at oracle dot com
@ 2015-07-10 14:45 ` paolo at gcc dot gnu.org
  2015-07-10 14:45 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-07-10 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Fri Jul 10 14:44:43 2015
New Revision: 225679

URL: https://gcc.gnu.org/viewcvs?rev=225679&root=gcc&view=rev
Log:
2015-07-10  Paolo Carlini  <paolo.carlini@oracle.com>

        PR c++/60842
        * g++.dg/cpp0x/nsdmi-template15.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-template15.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2015-07-10 14:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-14 17:35 [Bug c++/60842] New: In-class initializer causes a strange error kariya_mitsuru at hotmail dot com
2014-04-14 19:01 ` [Bug c++/60842] " redi at gcc dot gnu.org
2014-04-14 19:02 ` redi at gcc dot gnu.org
2014-12-14 15:39 ` ville.voutilainen at gmail dot com
2015-07-10 14:35 ` paolo.carlini at oracle dot com
2015-07-10 14:45 ` paolo at gcc dot gnu.org
2015-07-10 14:45 ` 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).