public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61471] New: redeclaration of default-argument in function template declaration not caught
@ 2014-06-11 10:45 filip.roseen at gmail dot com
2014-06-11 10:49 ` [Bug c++/61471] " filip.roseen at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: filip.roseen at gmail dot com @ 2014-06-11 10:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61471
Bug ID: 61471
Summary: redeclaration of default-argument in function template
declaration not caught
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: filip.roseen at gmail dot com
Created attachment 32921
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32921&action=edit
testcase.cpp
template<class T> void f(int=3);
template<class T> void f(int=3); // ill-formed
int main () { }
------------------------
`gcc` inaccurately accepts the above snippet, which is violating the following
[dcl.fct.default]p4:
> A default argument shall not be redefined b a later declaration
> (not even to the same value).
------------------------
By making `f` a non-template the violating is caught, and appropriate
diagnostics are shown.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/61471] redeclaration of default-argument in function template declaration not caught
2014-06-11 10:45 [Bug c++/61471] New: redeclaration of default-argument in function template declaration not caught filip.roseen at gmail dot com
@ 2014-06-11 10:49 ` filip.roseen at gmail dot com
2014-06-11 11:15 ` redi at gcc dot gnu.org
2014-06-11 11:23 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: filip.roseen at gmail dot com @ 2014-06-11 10:49 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 3203 bytes --]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61471
--- Comment #1 from Filip Roséen <filip.roseen at gmail dot com> ---
Created attachment 32922
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32922&action=edit
testcase-real.cpp
The previously attached `testcase.cpp` contains a code snippet for a related,
but different, bug.
See the newly attached testcase.cpp for contents matching the code in the
original post.
>From gcc-bugs-return-453667-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jun 11 10:53:27 2014
Return-Path: <gcc-bugs-return-453667-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 5180 invoked by alias); 11 Jun 2014 10:53:26 -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 4906 invoked by uid 48); 11 Jun 2014 10:53:22 -0000
From: "filip.roseen at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61472] New: added default-argument in later declaration of function template not caught
Date: Wed, 11 Jun 2014 10:53:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: filip.roseen at gmail dot com
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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-61472-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-06/txt/msg00749.txt.bz2
Content-length: 943
https://gcc.gnu.org/bugzilla/show_bug.cgi?ida472
Bug ID: 61472
Summary: added default-argument in later declaration of
function template not caught
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: filip.roseen at gmail dot com
Created attachment 32923
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id2923&actioníit
testcase.cpp
template<class T> void f(int);
template<class T> void f(int=3);
int main () { }
-----------------------------
`gcc` inaccurately accepts the above snippet, which is violating the following
sentence from [dcl.fct.default]p4:
> For non-template functions, default arguments can be added in later
> declarations of a function in the same scope.
-----------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/61471] redeclaration of default-argument in function template declaration not caught
2014-06-11 10:45 [Bug c++/61471] New: redeclaration of default-argument in function template declaration not caught filip.roseen at gmail dot com
2014-06-11 10:49 ` [Bug c++/61471] " filip.roseen at gmail dot com
@ 2014-06-11 11:15 ` redi at gcc dot gnu.org
2014-06-11 11:23 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2014-06-11 11:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61471
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-06-11
Ever confirmed|0 |1
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
We diagnose this if the function template is instantiated. I'm not sure if
we're required to diagnose it for uninstantiated templates.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/61471] redeclaration of default-argument in function template declaration not caught
2014-06-11 10:45 [Bug c++/61471] New: redeclaration of default-argument in function template declaration not caught filip.roseen at gmail dot com
2014-06-11 10:49 ` [Bug c++/61471] " filip.roseen at gmail dot com
2014-06-11 11:15 ` redi at gcc dot gnu.org
@ 2014-06-11 11:23 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2014-06-11 11:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61471
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oops, I messed up my test - we don't diagnose this even at instantiation
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-11 11:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-11 10:45 [Bug c++/61471] New: redeclaration of default-argument in function template declaration not caught filip.roseen at gmail dot com
2014-06-11 10:49 ` [Bug c++/61471] " filip.roseen at gmail dot com
2014-06-11 11:15 ` redi at gcc dot gnu.org
2014-06-11 11:23 ` 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).