public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/42018] Accepts definition for non-anonymous specialized template method within anonymous namespace
       [not found] <bug-42018-4@http.gcc.gnu.org/bugzilla/>
@ 2010-10-01 11:52 ` redi at gcc dot gnu.org
  2010-10-01 12:01 ` [Bug c++/42018] Template specialization in wrong namespace accepted if it matches template arguments of an earlier specialization redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2010-10-01 11:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.10.01 11:52:43
     Ever Confirmed|0                           |1
      Known to fail|                            |4.1.2, 4.3.4, 4.4.3, 4.5.1,
                   |                            |4.6.0

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-01 11:52:43 UTC ---
Oops, I've just realised I pasted the wrong code in comment 2, I meant to say
that this fails:

template<typename>
void foo(void);

namespace {
  template<>
  void foo<int>(void) { return; }
}

template<>
void foo<int>(void);

int main(int, char **) { foo<int>(); }

i.e. if the invalid specialization comes before the valid specialization, it's
rejected.

But in the original example, where the invalid specialization comes later, it's
incorrectly accepted. The same error should be given in both cases: the
specialization in the anon namespace does not match any primary template
declaration.


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

* [Bug c++/42018] Template specialization in wrong namespace accepted if it matches template arguments of an earlier specialization
       [not found] <bug-42018-4@http.gcc.gnu.org/bugzilla/>
  2010-10-01 11:52 ` [Bug c++/42018] Accepts definition for non-anonymous specialized template method within anonymous namespace redi at gcc dot gnu.org
@ 2010-10-01 12:01 ` redi at gcc dot gnu.org
  2010-10-01 21:21 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2010-10-01 12:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Accepts definition for      |Template specialization in
                   |non-anonymous specialized   |wrong namespace accepted if
                   |template method within      |it matches template
                   |anonymous namespace         |arguments of an earlier
                   |                            |specialization

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-01 12:00:51 UTC ---
It doesn't even depend on unnamed namespaces!

This is also accepted:

template<typename>
void foo(void);

template<>
void foo<int>(void);

namespace xxx {
  template<>
  void foo<int>(void) { return; }
}


I've adjusted the summary accordingly.


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

* [Bug c++/42018] Template specialization in wrong namespace accepted if it matches template arguments of an earlier specialization
       [not found] <bug-42018-4@http.gcc.gnu.org/bugzilla/>
  2010-10-01 11:52 ` [Bug c++/42018] Accepts definition for non-anonymous specialized template method within anonymous namespace redi at gcc dot gnu.org
  2010-10-01 12:01 ` [Bug c++/42018] Template specialization in wrong namespace accepted if it matches template arguments of an earlier specialization redi at gcc dot gnu.org
@ 2010-10-01 21:21 ` redi at gcc dot gnu.org
  2021-08-23  8:31 ` pinskia at gcc dot gnu.org
  2021-08-23  8:33 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2010-10-01 21:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-01 21:21:03 UTC ---
incomplete patch posted to
http://gcc.gnu.org/ml/gcc-patches/2010-10/msg00054.html


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

* [Bug c++/42018] Template specialization in wrong namespace accepted if it matches template arguments of an earlier specialization
       [not found] <bug-42018-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2010-10-01 21:21 ` redi at gcc dot gnu.org
@ 2021-08-23  8:31 ` pinskia at gcc dot gnu.org
  2021-08-23  8:33 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-23  8:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed by r7-4488

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

* [Bug c++/42018] Template specialization in wrong namespace accepted if it matches template arguments of an earlier specialization
       [not found] <bug-42018-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-08-23  8:31 ` pinskia at gcc dot gnu.org
@ 2021-08-23  8:33 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-23  8:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 56480.

*** This bug has been marked as a duplicate of bug 56480 ***

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

end of thread, other threads:[~2021-08-23  8:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-42018-4@http.gcc.gnu.org/bugzilla/>
2010-10-01 11:52 ` [Bug c++/42018] Accepts definition for non-anonymous specialized template method within anonymous namespace redi at gcc dot gnu.org
2010-10-01 12:01 ` [Bug c++/42018] Template specialization in wrong namespace accepted if it matches template arguments of an earlier specialization redi at gcc dot gnu.org
2010-10-01 21:21 ` redi at gcc dot gnu.org
2021-08-23  8:31 ` pinskia at gcc dot gnu.org
2021-08-23  8:33 ` 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).