public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/14926] New: libstdc++ rejects forward declarations.
@ 2004-04-12 17:57 vassili_bourdo at softhome dot net
  2004-04-12 18:03 ` [Bug libstdc++/14926] " vassili_bourdo at softhome dot net
                   ` (12 more replies)
  0 siblings, 13 replies; 15+ messages in thread
From: vassili_bourdo at softhome dot net @ 2004-04-12 17:57 UTC (permalink / raw)
  To: gcc-bugs

the code:

namespace std 
{
	template<class,class> class vector;//forward declaration
}

#include <vector>

int main()
{
	std::vector<int> v;
	return 0;
}

causes following compile-time error:

bug.cxx:2: error:   first declared as `template<class, class> struct 
std::vector' here
d:/tools/gcc/include/c++/3.4.0/bits/stl_vector.h:141: error:   also declared as 
`template<class _Tp, class _Alloc> class __gnu_norm::vector' here
bug.cxx:9: error: use of `vector' is ambiguous

-- 
           Summary: libstdc++ rejects forward declarations.
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vassili_bourdo at softhome dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug libstdc++/14926] libstdc++ rejects forward declarations.
  2004-04-12 17:57 [Bug libstdc++/14926] New: libstdc++ rejects forward declarations vassili_bourdo at softhome dot net
@ 2004-04-12 18:03 ` vassili_bourdo at softhome dot net
  2004-04-12 18:37 ` vassili_bourdo at softhome dot net
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: vassili_bourdo at softhome dot net @ 2004-04-12 18:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From vassili_bourdo at softhome dot net  2004-04-12 17:48 -------
Created an attachment (id=6078)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6078&action=view)
Test case #1


-- 


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


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

* [Bug libstdc++/14926] libstdc++ rejects forward declarations.
  2004-04-12 17:57 [Bug libstdc++/14926] New: libstdc++ rejects forward declarations vassili_bourdo at softhome dot net
  2004-04-12 18:03 ` [Bug libstdc++/14926] " vassili_bourdo at softhome dot net
@ 2004-04-12 18:37 ` vassili_bourdo at softhome dot net
  2004-04-12 18:42 ` vassili_bourdo at softhome dot net
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: vassili_bourdo at softhome dot net @ 2004-04-12 18:37 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |3.3.3


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


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

* [Bug libstdc++/14926] libstdc++ rejects forward declarations.
  2004-04-12 17:57 [Bug libstdc++/14926] New: libstdc++ rejects forward declarations vassili_bourdo at softhome dot net
  2004-04-12 18:03 ` [Bug libstdc++/14926] " vassili_bourdo at softhome dot net
  2004-04-12 18:37 ` vassili_bourdo at softhome dot net
@ 2004-04-12 18:42 ` vassili_bourdo at softhome dot net
  2004-04-12 18:43 ` [Bug c++/14926] [3.4/3.4 regression] forward declarations and strong using bangerth at dealii dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: vassili_bourdo at softhome dot net @ 2004-04-12 18:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From vassili_bourdo at softhome dot net  2004-04-12 17:53 -------
I believe this bug is related to __attribute__((strong)) introduced in 3.4.0 
and PR #13659

-- 


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


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

* [Bug c++/14926] [3.4/3.4 regression] forward declarations and strong using
  2004-04-12 17:57 [Bug libstdc++/14926] New: libstdc++ rejects forward declarations vassili_bourdo at softhome dot net
                   ` (2 preceding siblings ...)
  2004-04-12 18:42 ` vassili_bourdo at softhome dot net
@ 2004-04-12 18:43 ` bangerth at dealii dot org
  2004-04-12 18:54 ` [Bug c++/14926] [3.4/3.5 " pcarlini at suse dot de
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: bangerth at dealii dot org @ 2004-04-12 18:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-04-12 17:57 -------
Confirmed, an interesting side-effect of the strong-using extension in 
gcc. I guess Jason would be the right person? 
 
In any case, this is a regression in 3.4 and mainline over all previous 
versions. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org
           Severity|normal                      |critical
             Status|UNCONFIRMED                 |NEW
          Component|libstdc++                   |c++
     Ever Confirmed|                            |1
      Known to fail|                            |3.4.0 3.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-04-12 17:57:49
               date|                            |
            Summary|libstdc++ rejects forward   |[3.4/3.4 regression] forward
                   |declarations.               |declarations and strong
                   |                            |using
   Target Milestone|---                         |3.4.1


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


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

* [Bug c++/14926] [3.4/3.5 regression] forward declarations and strong using
  2004-04-12 17:57 [Bug libstdc++/14926] New: libstdc++ rejects forward declarations vassili_bourdo at softhome dot net
                   ` (3 preceding siblings ...)
  2004-04-12 18:43 ` [Bug c++/14926] [3.4/3.4 regression] forward declarations and strong using bangerth at dealii dot org
@ 2004-04-12 18:54 ` pcarlini at suse dot de
  2004-04-12 18:58 ` gdr at integrable-solutions dot net
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: pcarlini at suse dot de @ 2004-04-12 18:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-04-12 18:03 -------
Isn't this a duplicate of libstdc++/14370 (INVALID) ??

-- 


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


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

* [Bug c++/14926] [3.4/3.5 regression] forward declarations and strong using
  2004-04-12 17:57 [Bug libstdc++/14926] New: libstdc++ rejects forward declarations vassili_bourdo at softhome dot net
                   ` (4 preceding siblings ...)
  2004-04-12 18:54 ` [Bug c++/14926] [3.4/3.5 " pcarlini at suse dot de
@ 2004-04-12 18:58 ` gdr at integrable-solutions dot net
  2004-04-12 19:03 ` gdr at integrable-solutions dot net
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-04-12 18:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-04-12 18:37 -------
Subject: Re:  New: libstdc++ rejects forward declarations.

"vassili_bourdo at softhome dot net" <gcc-bugzilla@gcc.gnu.org> writes:

| the code:
| 
| namespace std 
| {
| 	template<class,class> class vector;//forward declaration

This is invoking undefined behaviour.


-- 


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


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

* [Bug c++/14926] [3.4/3.5 regression] forward declarations and strong using
  2004-04-12 17:57 [Bug libstdc++/14926] New: libstdc++ rejects forward declarations vassili_bourdo at softhome dot net
                   ` (6 preceding siblings ...)
  2004-04-12 19:03 ` gdr at integrable-solutions dot net
@ 2004-04-12 19:03 ` gdr at integrable-solutions dot net
  2004-04-12 20:00 ` [Bug libstdc++/14926] " bangerth at dealii dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-04-12 19:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-04-12 18:43 -------
Subject: Re:  [3.4/3.5 regression] forward declarations and strong using

"pcarlini at suse dot de" <gcc-bugzilla@gcc.gnu.org> writes:

| Isn't this a duplicate of libstdc++/14370 (INVALID) ??

It is.  (It is good to know someone remembers the PR ids :-))



-- 


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


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

* [Bug c++/14926] [3.4/3.5 regression] forward declarations and strong using
  2004-04-12 17:57 [Bug libstdc++/14926] New: libstdc++ rejects forward declarations vassili_bourdo at softhome dot net
                   ` (5 preceding siblings ...)
  2004-04-12 18:58 ` gdr at integrable-solutions dot net
@ 2004-04-12 19:03 ` gdr at integrable-solutions dot net
  2004-04-12 19:03 ` gdr at integrable-solutions dot net
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-04-12 19:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-04-12 18:42 -------
Subject: Re:  libstdc++ rejects forward declarations.

"vassili_bourdo at softhome dot net" <gcc-bugzilla@gcc.gnu.org> writes:

| I believe this bug is related to __attribute__((strong)) introduced in 3.4.0 
| and PR #13659

It is not a bug, it is a feature.
It never has been valid for users to forward declare primary templates
in std::.

-- Gaby


-- 


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


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

* [Bug libstdc++/14926] [3.4/3.5 regression] forward declarations and strong using
  2004-04-12 17:57 [Bug libstdc++/14926] New: libstdc++ rejects forward declarations vassili_bourdo at softhome dot net
                   ` (7 preceding siblings ...)
  2004-04-12 19:03 ` gdr at integrable-solutions dot net
@ 2004-04-12 20:00 ` bangerth at dealii dot org
  2004-04-12 20:40 ` gdr at integrable-solutions dot net
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: bangerth at dealii dot org @ 2004-04-12 20:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-04-12 19:03 -------
Alright then. I thought that this is something we should think about 
for the C++ side (not the libstdc++ side) regarding the semantics we 
give the strong using extension. However, you are right that we do 
not have to worry about this: as far as the library is concerned, the 
user can't rely on forward declaring stuff anyway (we are, IIRC, allowed 
to introduce additional template default parameters for example), and if 
this happens in user space with a user using "strong using", we can simply 
tell him to forward declare in the right namespace. 
 
W. 

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

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
          Component|c++                         |libstdc++
         Resolution|                            |DUPLICATE


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


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

* [Bug libstdc++/14926] [3.4/3.5 regression] forward declarations and strong using
  2004-04-12 17:57 [Bug libstdc++/14926] New: libstdc++ rejects forward declarations vassili_bourdo at softhome dot net
                   ` (8 preceding siblings ...)
  2004-04-12 20:00 ` [Bug libstdc++/14926] " bangerth at dealii dot org
@ 2004-04-12 20:40 ` gdr at integrable-solutions dot net
  2004-04-12 20:41 ` bangerth at dealii dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-04-12 20:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-04-12 19:48 -------
Subject: Re:  [3.4/3.5 regression] forward declarations and strong using

"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| ------- Additional Comments From bangerth at dealii dot org  2004-04-12 19:03 -------
| Alright then. I thought that this is something we should think about 
| for the C++ side (not the libstdc++ side) regarding the semantics we 
| give the strong using extension. However, you are right that we do 
| not have to worry about this: as far as the library is concerned, the 
| user can't rely on forward declaring stuff anyway (we are, IIRC, allowed 
| to introduce additional template default parameters for example), and if 

Err, we're not allowed to introduce additional default template
parameters (contrary to what the latitude parameters for non virtual
member functions) 

| this happens in user space with a user using "strong using", we can simply 
| tell him to forward declare in the right namespace. 

Yes, "strong using" is for the super user :-)

-- Gaby


-- 


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


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

* [Bug libstdc++/14926] [3.4/3.5 regression] forward declarations and strong using
  2004-04-12 17:57 [Bug libstdc++/14926] New: libstdc++ rejects forward declarations vassili_bourdo at softhome dot net
                   ` (9 preceding siblings ...)
  2004-04-12 20:40 ` gdr at integrable-solutions dot net
@ 2004-04-12 20:41 ` bangerth at dealii dot org
  2004-04-12 22:14   ` llewelly
  2004-04-12 22:15 ` llewelly at xmission dot com
  2004-04-12 22:54 ` bangerth at dealii dot org
  12 siblings, 1 reply; 15+ messages in thread
From: bangerth at dealii dot org @ 2004-04-12 20:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-04-12 20:00 -------
I was under the impression that an implementation was allowed to declare 
(for example) its vector class as 
  template <typename T, typename Allocator = alloc<something>, 
            typename additional_parameter=something > 
  class vector {...}; 
and that this was the reason to make forward declarations of classes in 
namespace std:: undefined. I may be wrong, though. It doesn't also matter 
here. 
 
W. 

-- 


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


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

* Re: [Bug libstdc++/14926] [3.4/3.5 regression] forward declarations and strong using
  2004-04-12 20:41 ` bangerth at dealii dot org
@ 2004-04-12 22:14   ` llewelly
  0 siblings, 0 replies; 15+ messages in thread
From: llewelly @ 2004-04-12 22:14 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:

> ------- Additional Comments From bangerth at dealii dot org  2004-04-12 20:00 -------
> I was under the impression that an implementation was allowed to declare 
> (for example) its vector class as 
>   template <typename T, typename Allocator = alloc<something>, 
>             typename additional_parameter=something > 
>   class vector {...}; 
> and that this was the reason to make forward declarations of classes in 
> namespace std:: undefined. I may be wrong, though. It doesn't also matter 
> here. 

http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-closed.html#94
explains why additional template parameters are not allowed.


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

* [Bug libstdc++/14926] [3.4/3.5 regression] forward declarations and strong using
  2004-04-12 17:57 [Bug libstdc++/14926] New: libstdc++ rejects forward declarations vassili_bourdo at softhome dot net
                   ` (10 preceding siblings ...)
  2004-04-12 20:41 ` bangerth at dealii dot org
@ 2004-04-12 22:15 ` llewelly at xmission dot com
  2004-04-12 22:54 ` bangerth at dealii dot org
  12 siblings, 0 replies; 15+ messages in thread
From: llewelly at xmission dot com @ 2004-04-12 22:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From llewelly at xmission dot com  2004-04-12 21:52 -------
Subject: Re:  [3.4/3.5 regression] forward declarations and strong using

"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:

> ------- Additional Comments From bangerth at dealii dot org  2004-04-12 20:00 -------
> I was under the impression that an implementation was allowed to declare 
> (for example) its vector class as 
>   template <typename T, typename Allocator = alloc<something>, 
>             typename additional_parameter=something > 
>   class vector {...}; 
> and that this was the reason to make forward declarations of classes in 
> namespace std:: undefined. I may be wrong, though. It doesn't also matter 
> here. 

http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-closed.html#94
explains why additional template parameters are not allowed.


-- 


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


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

* [Bug libstdc++/14926] [3.4/3.5 regression] forward declarations and strong using
  2004-04-12 17:57 [Bug libstdc++/14926] New: libstdc++ rejects forward declarations vassili_bourdo at softhome dot net
                   ` (11 preceding siblings ...)
  2004-04-12 22:15 ` llewelly at xmission dot com
@ 2004-04-12 22:54 ` bangerth at dealii dot org
  12 siblings, 0 replies; 15+ messages in thread
From: bangerth at dealii dot org @ 2004-04-12 22:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-04-12 22:11 -------
Ah, thanks for the pointer. I am around too long, so the original discussion 
was still sticking in my head as there was a time when things like  
additional template parameters could happen to you... 
 
W. 

-- 


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


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

end of thread, other threads:[~2004-04-12 22:11 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-12 17:57 [Bug libstdc++/14926] New: libstdc++ rejects forward declarations vassili_bourdo at softhome dot net
2004-04-12 18:03 ` [Bug libstdc++/14926] " vassili_bourdo at softhome dot net
2004-04-12 18:37 ` vassili_bourdo at softhome dot net
2004-04-12 18:42 ` vassili_bourdo at softhome dot net
2004-04-12 18:43 ` [Bug c++/14926] [3.4/3.4 regression] forward declarations and strong using bangerth at dealii dot org
2004-04-12 18:54 ` [Bug c++/14926] [3.4/3.5 " pcarlini at suse dot de
2004-04-12 18:58 ` gdr at integrable-solutions dot net
2004-04-12 19:03 ` gdr at integrable-solutions dot net
2004-04-12 19:03 ` gdr at integrable-solutions dot net
2004-04-12 20:00 ` [Bug libstdc++/14926] " bangerth at dealii dot org
2004-04-12 20:40 ` gdr at integrable-solutions dot net
2004-04-12 20:41 ` bangerth at dealii dot org
2004-04-12 22:14   ` llewelly
2004-04-12 22:15 ` llewelly at xmission dot com
2004-04-12 22:54 ` bangerth at dealii dot 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).