public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23263] New: Fails to identify member definition
@ 2005-08-06 20:23 igodard at pacbell dot net
  2005-08-06 20:29 ` [Bug c++/23263] " bangerth at dealii dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: igodard at pacbell dot net @ 2005-08-06 20:23 UTC (permalink / raw)
  To: gcc-bugs

template<typename T> struct foo{ static T* p; };
template<typename T> T* foo<T>::p = 0;

template<typename T> struct A {};
template<typename T, template<typename> class C>
    struct bar{ static C<void>* p; };
template<typename T> A<void>* bar<T,A>::p = 0;

int main() {
    foo<int> f;
    bar<int, A> b;
    return 0;
    }

gets you:
~/ootbc/members/src$ g++ foo.cc
foo.cc:7: error: invalid use of undefined type `struct bar<T, A>'
foo.cc:6: error: declaration of `struct bar<T, A>'

As it works for the plain type case (foo), it looks like something's wrong in
the binding of template template parameters (bar).

Ivan

-- 
           Summary: Fails to identify member definition
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/23263] Fails to identify member definition
  2005-08-06 20:23 [Bug c++/23263] New: Fails to identify member definition igodard at pacbell dot net
@ 2005-08-06 20:29 ` bangerth at dealii dot org
  2005-08-06 20:40 ` igodard at pacbell dot net
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2005-08-06 20:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-08-06 20:29 -------
No, you try to partially specialize a member. That isn't allowed.  
You either have to completely specialize all template parameters, or  
none. Long standing annoyance in C++...  
  
W.  

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c++/23263] Fails to identify member definition
  2005-08-06 20:23 [Bug c++/23263] New: Fails to identify member definition igodard at pacbell dot net
  2005-08-06 20:29 ` [Bug c++/23263] " bangerth at dealii dot org
@ 2005-08-06 20:40 ` igodard at pacbell dot net
  2005-08-06 22:38 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: igodard at pacbell dot net @ 2005-08-06 20:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From igodard at pacbell dot net  2005-08-06 20:40 -------
Reopened as a complaint about the diagnostic. The naive (or even reasonably
sophisticated) user cannot figure out "illegal partial specialization" from that
message.

Comeau gives:

"ComeauTest.c", line 7: error: template argument list must match the parameter list
  template<typename T> A<void>* bar<T,A>::p = 0;
                                ^

which I admit is only a little better.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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

* [Bug c++/23263] Fails to identify member definition
  2005-08-06 20:23 [Bug c++/23263] New: Fails to identify member definition igodard at pacbell dot net
  2005-08-06 20:29 ` [Bug c++/23263] " bangerth at dealii dot org
  2005-08-06 20:40 ` igodard at pacbell dot net
@ 2005-08-06 22:38 ` pinskia at gcc dot gnu dot org
  2005-08-06 22:56 ` [Bug c++/23263] Incomprehensible message for invalid attempt to partially specialize a member bangerth at dealii dot org
  2005-08-08  2:42 ` igodard at pacbell dot net
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-06 22:38 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Keywords|                            |diagnostic


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


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

* [Bug c++/23263] Incomprehensible message for invalid attempt to partially specialize a member
  2005-08-06 20:23 [Bug c++/23263] New: Fails to identify member definition igodard at pacbell dot net
                   ` (2 preceding siblings ...)
  2005-08-06 22:38 ` pinskia at gcc dot gnu dot org
@ 2005-08-06 22:56 ` bangerth at dealii dot org
  2005-08-08  2:42 ` igodard at pacbell dot net
  4 siblings, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2005-08-06 22:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-08-06 22:56 -------
If you know what's going on, the error message is actually clear:  
  foo.cc:7: error: invalid use of undefined type `struct bar<T, A>'  
This just means that the partially specialized class bar<T,A> has not  
yet been declared, and that you can't therefore define a member of it.  
  
But I grant that we could do better. For that purpose, this example 
may be better: 
--------------------- 
template <int A, int B> struct X { void f(); }; 
template <int A> void X<A,1>::f() {} 
--------------------- 
We presently get this: 
g/x> /home/bangerth/bin/gcc-4.1-pre/bin/c++ -c x.cc 
x.cc:2: error: invalid use of undefined type &#8216;struct X<A, 1>&#8217; 
x.cc:1: error: declaration of &#8216;struct X<A, 1>&#8217; 
x.cc:2: error: template definition of non-template &#8216;void X<A, 1>::f()&#8217; 
  
W.  

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-06 22:56:41
               date|                            |
            Summary|Fails to identify member    |Incomprehensible message for
                   |definition                  |invalid attempt to partially
                   |                            |specialize a member


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


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

* [Bug c++/23263] Incomprehensible message for invalid attempt to partially specialize a member
  2005-08-06 20:23 [Bug c++/23263] New: Fails to identify member definition igodard at pacbell dot net
                   ` (3 preceding siblings ...)
  2005-08-06 22:56 ` [Bug c++/23263] Incomprehensible message for invalid attempt to partially specialize a member bangerth at dealii dot org
@ 2005-08-08  2:42 ` igodard at pacbell dot net
  4 siblings, 0 replies; 6+ messages in thread
From: igodard at pacbell dot net @ 2005-08-08  2:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From igodard at pacbell dot net  2005-08-08 02:42 -------
See also #23281

Should this and other reports about diagnostic quality be treated as
"enhancement requests"? I suppose tht it depends on what you consider
"correctness". If that means "conforming to standard", then any diagnostic will
do, including "something wrong found somewhere in program". Personally I use a
different standard of "correct", which includes "usable", and so addresses
issues like compilation time measured in days as well as quality of diagnostic.

I understand that the gcc implementation community has a notion of "QOI"
(quality of implementation) which reflects much of what I call "usable". But I
would distinguish a "defect of QOI" from an "enhancement request"; the latter
being something nice to have, but the former impacting real usage.

I put this particular DR in the "defect of QOI" category. Even if you do not,
you probably can select a non-empty set of DRs that are truly "defects" and not
mere "enhancement requests. 

Consequently I'm filing this as a DR against the gcc DR reporting machinery
itself, rather than against the compiler in particular. There needs to be
categories for QOI defects of varying severity; either that, or complaints about
diagnostics and other QOI ussues should not by policy be filed as "enhancement
requests", and forgotten.

-- 


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


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

end of thread, other threads:[~2005-08-08  2:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-06 20:23 [Bug c++/23263] New: Fails to identify member definition igodard at pacbell dot net
2005-08-06 20:29 ` [Bug c++/23263] " bangerth at dealii dot org
2005-08-06 20:40 ` igodard at pacbell dot net
2005-08-06 22:38 ` pinskia at gcc dot gnu dot org
2005-08-06 22:56 ` [Bug c++/23263] Incomprehensible message for invalid attempt to partially specialize a member bangerth at dealii dot org
2005-08-08  2:42 ` igodard at pacbell dot net

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).