public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50370] New: [C++0x] Multiple declarations with default template arguments accepted
@ 2011-09-12 22:34 daniel.kruegler at googlemail dot com
  2012-01-28  6:28 ` [Bug c++/50370] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-09-12 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50370
           Summary: [C++0x] Multiple declarations with default template
                    arguments accepted
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com
                CC: jason@redhat.com


gcc 4.7.0 20110903 (experimental) in C++0x mode accepts the following code:

template<class T, class = int>
void foo(T);

template<class T, class = int>
void foo(T) {}

template<class = int>
void bar();

template<class = int>
void bar() {}

int main() {
  foo(12);
  bar();
}

According to 14.1 [temp.param] p12 this code should be rejected:

"A template-parameter shall not be given default arguments by two different
declarations in the same scope. [ Example:
  template<class T = int> class X;
  template<class T = int> class X { /*... */ }; // error
—end example ]"

gcc correctly rejects such examples when class templates are involved, but
fails to do so for function templates. 

This looks very similar to bug 15339 or bug 48372, but the domain (default
template arguments) is different.


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

* [Bug c++/50370] [C++0x] Multiple declarations with default template arguments accepted
  2011-09-12 22:34 [Bug c++/50370] New: [C++0x] Multiple declarations with default template arguments accepted daniel.kruegler at googlemail dot com
@ 2012-01-28  6:28 ` pinskia at gcc dot gnu.org
  2013-09-16 14:34 ` jwillemsen at remedy dot nl
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-28  6:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-28
     Ever Confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-28 05:51:53 UTC ---
Confirmed.


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

* [Bug c++/50370] [C++0x] Multiple declarations with default template arguments accepted
  2011-09-12 22:34 [Bug c++/50370] New: [C++0x] Multiple declarations with default template arguments accepted daniel.kruegler at googlemail dot com
  2012-01-28  6:28 ` [Bug c++/50370] " pinskia at gcc dot gnu.org
@ 2013-09-16 14:34 ` jwillemsen at remedy dot nl
  2020-07-16 17:07 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jwillemsen at remedy dot nl @ 2013-09-16 14:34 UTC (permalink / raw)
  To: gcc-bugs

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

Johnny Willemsen <jwillemsen at remedy dot nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jwillemsen at remedy dot nl

--- Comment #2 from Johnny Willemsen <jwillemsen at remedy dot nl> ---
Also reproduced with GCC 4.8.1


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

* [Bug c++/50370] [C++0x] Multiple declarations with default template arguments accepted
  2011-09-12 22:34 [Bug c++/50370] New: [C++0x] Multiple declarations with default template arguments accepted daniel.kruegler at googlemail dot com
  2012-01-28  6:28 ` [Bug c++/50370] " pinskia at gcc dot gnu.org
  2013-09-16 14:34 ` jwillemsen at remedy dot nl
@ 2020-07-16 17:07 ` mpolacek at gcc dot gnu.org
  2020-07-16 17:29 ` mpolacek at gcc dot gnu.org
  2022-03-09 13:50 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-07-16 17:07 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ec13n at my dot fsu.edu

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 82850 has been marked as a duplicate of this bug. ***

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

* [Bug c++/50370] [C++0x] Multiple declarations with default template arguments accepted
  2011-09-12 22:34 [Bug c++/50370] New: [C++0x] Multiple declarations with default template arguments accepted daniel.kruegler at googlemail dot com
                   ` (2 preceding siblings ...)
  2020-07-16 17:07 ` mpolacek at gcc dot gnu.org
@ 2020-07-16 17:29 ` mpolacek at gcc dot gnu.org
  2022-03-09 13:50 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-07-16 17:29 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |david.bolvansky at gmail dot com

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 87234 has been marked as a duplicate of this bug. ***

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

* [Bug c++/50370] [C++0x] Multiple declarations with default template arguments accepted
  2011-09-12 22:34 [Bug c++/50370] New: [C++0x] Multiple declarations with default template arguments accepted daniel.kruegler at googlemail dot com
                   ` (3 preceding siblings ...)
  2020-07-16 17:29 ` mpolacek at gcc dot gnu.org
@ 2022-03-09 13:50 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-03-09 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ppalka at gcc dot gnu.org
         Resolution|---                         |FIXED
   Target Milestone|---                         |12.0
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed alongside with PR65396 for GCC 12 by r12-7562-gfe548eb8436f39.

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

end of thread, other threads:[~2022-03-09 13:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-12 22:34 [Bug c++/50370] New: [C++0x] Multiple declarations with default template arguments accepted daniel.kruegler at googlemail dot com
2012-01-28  6:28 ` [Bug c++/50370] " pinskia at gcc dot gnu.org
2013-09-16 14:34 ` jwillemsen at remedy dot nl
2020-07-16 17:07 ` mpolacek at gcc dot gnu.org
2020-07-16 17:29 ` mpolacek at gcc dot gnu.org
2022-03-09 13:50 ` ppalka 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).