public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/9050] Can't explicitly specialize C++ constructor templates
       [not found] <20021223190601.9050.martin@xemacs.org>
@ 2003-05-25 16:51 ` pinskia@physics.uc.edu
  2003-08-05 15:12 ` reichelt at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: pinskia@physics.uc.edu @ 2003-05-25 16:51 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia@physics.uc.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2003-04-30 00:00:00         |2003-05-25 16:24:07
               date|                            |


------- Additional Comments From pinskia@physics.uc.edu  2003-05-25 16:24 -------
it still happens in the mainline (20030525) but it produces different error message:
[omni:~/src/gccPRs] pinskia% g++ pr9050.cc
pr9050.cc:11: error: expected unqualified-id



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug c++/9050] Can't explicitly specialize C++ constructor templates
       [not found] <20021223190601.9050.martin@xemacs.org>
  2003-05-25 16:51 ` [Bug c++/9050] Can't explicitly specialize C++ constructor templates pinskia@physics.uc.edu
@ 2003-08-05 15:12 ` reichelt at gcc dot gnu dot org
  2004-01-06 13:07 ` reichelt at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2003-08-05 15:12 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From reichelt at gcc dot gnu dot org  2003-08-05 15:12 -------
This seems to be related to PR 10832.


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

* [Bug c++/9050] Can't explicitly specialize C++ constructor templates
       [not found] <20021223190601.9050.martin@xemacs.org>
  2003-05-25 16:51 ` [Bug c++/9050] Can't explicitly specialize C++ constructor templates pinskia@physics.uc.edu
  2003-08-05 15:12 ` reichelt at gcc dot gnu dot org
@ 2004-01-06 13:07 ` reichelt at gcc dot gnu dot org
  2004-06-05 18:13 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-01-06 13:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-01-06 13:07 -------
The error message on mainline now is:

bug.cc:11: error: `Y' is not a template
bug.cc:11: error: expected unqualified-id before "int"
bug.cc:11: error: expected `)' before "int"
bug.cc:11: error: expected `;' before "int"


-- 


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


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

* [Bug c++/9050] Can't explicitly specialize C++ constructor templates
       [not found] <20021223190601.9050.martin@xemacs.org>
                   ` (2 preceding siblings ...)
  2004-01-06 13:07 ` reichelt at gcc dot gnu dot org
@ 2004-06-05 18:13 ` pinskia at gcc dot gnu dot org
  2004-07-22 17:05 ` chris at pgsql dot com
  2004-07-22 18:36 ` bangerth at dealii dot org
  5 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-05 18:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-05 18:13 -------
*** Bug 10832 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gprentice at paradise dot
                   |                            |net dot nz


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


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

* [Bug c++/9050] Can't explicitly specialize C++ constructor templates
       [not found] <20021223190601.9050.martin@xemacs.org>
                   ` (3 preceding siblings ...)
  2004-06-05 18:13 ` pinskia at gcc dot gnu dot org
@ 2004-07-22 17:05 ` chris at pgsql dot com
  2004-07-22 18:36 ` bangerth at dealii dot org
  5 siblings, 0 replies; 10+ messages in thread
From: chris at pgsql dot com @ 2004-07-22 17:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From chris at pgsql dot com  2004-07-22 17:05 -------
Hi All, 

 I've been working on a project for the last month or so and have ran into this 
bug under G++ 2.95.4. The code I have is different from the code above and is 
as follows:

test.hxx

template <class T> class Test {
 private:
  T *handle_object;

 public:

  Test(T * = NULL);
  Test(const Test<T> &);

  ~Test();

  bool operator==(const Test<T> &) const;
};

class MyTest;
typedef Test<MyTest> MyTestHandle;

Test.cxx:

template <class T> Test<T>::Test(T* th) {
 this->handle_object = th;

 if (this->handle_object != NULL) {
  this->handle_object->counter++;
 }
}

template <class T> Test<T>::Test(const Test<T> &source) {
 this->handle_object = source.handle_object;

 if (this->handle_object != NULL) {
  this->handle_object->counter++;
 }
}

template <class T> Test<T>::~Test() {
 if (this->handle_object != NULL && this->handle_object->counter != 0) {
  this->handle_object->counter--;
 }

 if (this->handle_object != NULL && this->handle_object->counter == 0) {
  delete this->handle_object;
  this->handle_object = NULL;
 }
}

template <class T> bool Test<T>::operator==(const Test<T> &source) const {
 return (this->handle_object == source->handle_object);
}

When I left it in this format I got this error:

test/libtest.a(MyBigTest.o): In function `MyBigTest::add(Test<MyTest> const &)':
/usr/local/include/stlport/stl/_construct.h:237: undefined reference to 
`Test<MyTest>::Test(Test<MyTest> const &)'
test/libtest.a(MyBigTest.o): In function `MyBigTest::remove(Test<MyTest> &)':
/usr/local/include/stlport/stl/_list.h:122: undefined reference to 
`Test<MyTest>::operator==(Test<MyTest> const &) const'
test/libtest.a(MyBigTest.o): In function `MyBigTest::remove(Test<MyTest> &)':
/usr/local/include/stlport/stl/_construct.h:360: undefined reference to 
`Test<MyTest>::~Test(void)'
test/libtest.a(MyBigTest.o): In function `_STL::allocator<Test<MyTest> 
>::~allocator(void)':
/usr/local/include/stlport/stl/_alloc.h
(.gnu.linkonce.t.clear__Q24_STLt10_List_base2Zt14Test1Z6MyTestZQ24_STLt9allocato
r1Zt14Test1Z6MyTest+0x26): undefined reference to `Test<MyTest>::~Test(void)'
*** Error code 1

Research showed that I needed to instantiate my template using:

template void Test<MyTest>();

 in the Test.cpp file so that it can create an instance in the libtest.a file, 
so that when I compile that into my app it would link properly. However, I now 
run into a compiler error (rather then a linking error) like this:

Test.cxx:52: `Test<MyTest>' specified as declarator-id
Test.cxx:52: two or more data types in declaration of `Test<MyTest>'
Test.cxx:52: non-template used as template
Test.cxx:52: confused by earlier errors, bailing out
*** Error code 1

 Which I believe is related to the issue above. I'm building under FreeBSD 4.10-
STABLE. Does anyone have a fix for this yet? or did I do something wrong?

-- 


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


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

* [Bug c++/9050] Can't explicitly specialize C++ constructor templates
       [not found] <20021223190601.9050.martin@xemacs.org>
                   ` (4 preceding siblings ...)
  2004-07-22 17:05 ` chris at pgsql dot com
@ 2004-07-22 18:36 ` bangerth at dealii dot org
  5 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2004-07-22 18:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-07-22 18:36 -------
The problem in comment #6 has nothing to do with the rest of the 
PR. The syntax to explicitly instantiate the class is just completely 
bogus. It should read 
  template class Test<MyTest>; 
but there are more bugs (specificly: MyTest is only forward declared). 
 
The original problem of this PR persists as of now. 
 
W. 

-- 


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


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

* [Bug c++/9050] Can't explicitly specialize C++ constructor templates
       [not found] <bug-9050-2393@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2008-10-26 22:02 ` manu at gcc dot gnu dot org
@ 2009-11-20  5:17 ` jason at gcc dot gnu dot org
  3 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-20  5:17 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-02-11 23:43:25         |2009-11-20 05:17:23
               date|                            |


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


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

* [Bug c++/9050] Can't explicitly specialize C++ constructor templates
       [not found] <bug-9050-2393@http.gcc.gnu.org/bugzilla/>
  2008-02-11 22:20 ` vlad dot sharanhovich at gmail dot com
  2008-02-11 23:44 ` manu at gcc dot gnu dot org
@ 2008-10-26 22:02 ` manu at gcc dot gnu dot org
  2009-11-20  5:17 ` jason at gcc dot gnu dot org
  3 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-10-26 22:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from manu at gcc dot gnu dot org  2008-10-26 22:01 -------
It seems that the problem is cp_parser_template_id fails to parse Y<int> as a
template-id because when it does a lookup it finds that Y is just a
non-template class and concludes that Y<int> cannot be a template-id. This in
turn makes cp_parser_class_name fail to parse Y<int>, which makes
cp_parser_constructor_declarator_p return false.

No idea how this could be fixed...


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|3.4.3 4.1.2 4.3.0           |3.4.3 4.1.2 4.3.0 4.4.0


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


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

* [Bug c++/9050] Can't explicitly specialize C++ constructor templates
       [not found] <bug-9050-2393@http.gcc.gnu.org/bugzilla/>
  2008-02-11 22:20 ` vlad dot sharanhovich at gmail dot com
@ 2008-02-11 23:44 ` manu at gcc dot gnu dot org
  2008-10-26 22:02 ` manu at gcc dot gnu dot org
  2009-11-20  5:17 ` jason at gcc dot gnu dot org
  3 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-11 23:44 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1357 bytes --]



------- Comment #9 from manu at gcc dot gnu dot org  2008-02-11 23:43 -------
(In reply to comment #8)
> This bug is present in gcc 3.4.3. Was ever fixed or forgotten forever?

manuel@gcc12:~$ ~/132202/build/gcc/cc1plus --version
GNU C++ (GCC) version 4.3.0 20080209 (experimental) [trunk revision 132202]
(x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.3.0 20080209 (experimental) [trunk revision
132202], GMP version 4.2.2, MPFR version 2.3.0.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096

manuel@gcc12:~$ ~/132202/build/gcc/cc1plus src/pr9050.C
 void Y::foo(T) [with T = bool] void Y::foo(T) [with T = int] Y::Y(T) [with T =
bool] Y::Y(T) [with T = bool] Y::Y(T) [with T = bool]
src/pr9050.C: At global scope:
src/pr9050.C:11: error: ‘Y’ is not a template
src/pr9050.C:11: error: expected unqualified-id before ‘int’
src/pr9050.C:11: error: expected `)' before ‘int’

Not fixed.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
   Last reconfirmed|2006-09-03 21:39:40         |2008-02-11 23:43:25
               date|                            |


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


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

* [Bug c++/9050] Can't explicitly specialize C++ constructor templates
       [not found] <bug-9050-2393@http.gcc.gnu.org/bugzilla/>
@ 2008-02-11 22:20 ` vlad dot sharanhovich at gmail dot com
  2008-02-11 23:44 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: vlad dot sharanhovich at gmail dot com @ 2008-02-11 22:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from vlad dot sharanhovich at gmail dot com  2008-02-11 22:19 -------
This bug is present in gcc 3.4.3. Was ever fixed or forgotten forever?


-- 

vlad dot sharanhovich at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vlad dot sharanhovich at
                   |                            |gmail dot com


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


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

end of thread, other threads:[~2009-11-20  5:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20021223190601.9050.martin@xemacs.org>
2003-05-25 16:51 ` [Bug c++/9050] Can't explicitly specialize C++ constructor templates pinskia@physics.uc.edu
2003-08-05 15:12 ` reichelt at gcc dot gnu dot org
2004-01-06 13:07 ` reichelt at gcc dot gnu dot org
2004-06-05 18:13 ` pinskia at gcc dot gnu dot org
2004-07-22 17:05 ` chris at pgsql dot com
2004-07-22 18:36 ` bangerth at dealii dot org
     [not found] <bug-9050-2393@http.gcc.gnu.org/bugzilla/>
2008-02-11 22:20 ` vlad dot sharanhovich at gmail dot com
2008-02-11 23:44 ` manu at gcc dot gnu dot org
2008-10-26 22:02 ` manu at gcc dot gnu dot org
2009-11-20  5:17 ` jason at gcc dot gnu 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).