public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61975] New: default template arguments do not work with out-of-class class declaration
@ 2014-07-31 11:12 vanyacpp at gmail dot com
  2014-07-31 11:32 ` [Bug c++/61975] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vanyacpp at gmail dot com @ 2014-07-31 11:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61975
           Summary: default template arguments do not work with
                    out-of-class class declaration
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vanyacpp at gmail dot com

GCC shows error on this code:

template <typename T>
struct x
{
    template <typename U>
    struct y;
};


template <>
template <typename U = int>
struct x<int>::y
{
    typedef U type;
};

x<int>::y<>::type a;

2.cpp:17:11: error: wrong number of template arguments (0, should be 1)
 x<int>::y<>::type a;
           ^
2.cpp:5:12: error: provided for ‘template<class U> struct x<int>::y<U>’
     struct y;
            ^
2.cpp:17:19: error: expected initializer before ‘a’
 x<int>::y<>::type a;
                   ^

I think this code is correct because default argument for parameter U is
specified. Clang compiles this code correctly.
>From gcc-bugs-return-457453-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jul 31 11:14:35 2014
Return-Path: <gcc-bugs-return-457453-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 15022 invoked by alias); 31 Jul 2014 11:14:34 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 14988 invoked by uid 48); 31 Jul 2014 11:14:30 -0000
From: "jamborm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/61393] [trans-mem] O3 optimization level constant propagation problem
Date: Thu, 31 Jul 2014 11:14:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ipa
X-Bugzilla-Version: 4.10.0
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jamborm at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61393-4-0rHBw4jLz2@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61393-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61393-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-07/txt/msg02044.txt.bz2
Content-length: 611

https://gcc.gnu.org/bugzilla/show_bug.cgi?ida393

--- Comment #6 from Martin Jambor <jamborm at gcc dot gnu.org> ---
(In reply to Martin Jambor from comment #1)
> However, I do not really know what the semantics of that flag mean so
> at least for now I am not going to propose this (I am also not quite
> sure this is the best place for the copy).  What properties of a
> function should be maintained in order to keep it flagged as a tm
> clone?

No answer, so I have actually proposed a variant of the patch in the
comment #1 to the mailing list:

https://gcc.gnu.org/ml/gcc-patches/2014-07/msg02105.html


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

* [Bug c++/61975] default template arguments do not work with out-of-class class declaration
  2014-07-31 11:12 [Bug c++/61975] New: default template arguments do not work with out-of-class class declaration vanyacpp at gmail dot com
@ 2014-07-31 11:32 ` redi at gcc dot gnu.org
  2014-09-17 16:32 ` paolo.carlini at oracle dot com
  2021-08-04 19:32 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2014-07-31 11:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-07-31
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
EDG accepts it too


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

* [Bug c++/61975] default template arguments do not work with out-of-class class declaration
  2014-07-31 11:12 [Bug c++/61975] New: default template arguments do not work with out-of-class class declaration vanyacpp at gmail dot com
  2014-07-31 11:32 ` [Bug c++/61975] " redi at gcc dot gnu.org
@ 2014-09-17 16:32 ` paolo.carlini at oracle dot com
  2021-08-04 19:32 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-09-17 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Related to c++/53856


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

* [Bug c++/61975] default template arguments do not work with out-of-class class declaration
  2014-07-31 11:12 [Bug c++/61975] New: default template arguments do not work with out-of-class class declaration vanyacpp at gmail dot com
  2014-07-31 11:32 ` [Bug c++/61975] " redi at gcc dot gnu.org
  2014-09-17 16:32 ` paolo.carlini at oracle dot com
@ 2021-08-04 19:32 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-04 19:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2014-07-31 00:00:00         |2021-8-4
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=53856

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang ICEs (at c++20) but accepts it at C++17 and before.
ICC acepts the code
MSVC rejects it with an error message close to GCC.

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

end of thread, other threads:[~2021-08-04 19:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-31 11:12 [Bug c++/61975] New: default template arguments do not work with out-of-class class declaration vanyacpp at gmail dot com
2014-07-31 11:32 ` [Bug c++/61975] " redi at gcc dot gnu.org
2014-09-17 16:32 ` paolo.carlini at oracle dot com
2021-08-04 19:32 ` pinskia 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).