public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27211]  New: Bogus error "template definition of non-template" when there is no non-template
@ 2006-04-19  9:11 reichelt at gcc dot gnu dot org
  2006-04-22 20:27 ` [Bug c++/27211] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-04-19  9:11 UTC (permalink / raw)
  To: gcc-bugs

The following testcase generates a questionable diagnostic:

===================================
struct A {};

template<int> void A::foo() {}
===================================

bug1.cc:3: error: no 'void A::foo()' member function declared in class 'A'
bug1.cc:3: error: template definition of non-template 'void A::foo()'

The second line is bogus, because there is no non-template definition
of A::foo. (This happens since at least GCC 2.95.x).

A slightly different testcase generates an even worse diagnostic:

===================================
struct A {};

template<int> void A::foo();
===================================

bug2.cc:3: error: no 'void A::foo()' member function declared in class 'A'
bug2.cc:3: error: prototype for 'void A::foo()' does not match any in class 'A'
bug2.cc:3: error: candidate is: void A::foo()
bug2.cc:3: error: declaration of 'void A::foo()' outside of class is not
definition
bug2.cc:3: error: template definition of non-template 'void A::foo()'

Here we also have a bogus "candidate is" message.


-- 
           Summary: Bogus error "template definition of non-template" when
                    there is no non-template
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: diagnostic, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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


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

* [Bug c++/27211] Bogus error "template definition of non-template" when there is no non-template
  2006-04-19  9:11 [Bug c++/27211] New: Bogus error "template definition of non-template" when there is no non-template reichelt at gcc dot gnu dot org
@ 2006-04-22 20:27 ` pinskia at gcc dot gnu dot org
  2006-05-26 15:30 ` bangerth at dealii dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-22 20:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-04-22 20:27 -------
I don't know if it is that bogus.  First it assumes if it is not defiend, it is
a normal member function and not a templated member function which seems
reasonable.


-- 


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


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

* [Bug c++/27211] Bogus error "template definition of non-template" when there is no non-template
  2006-04-19  9:11 [Bug c++/27211] New: Bogus error "template definition of non-template" when there is no non-template reichelt at gcc dot gnu dot org
  2006-04-22 20:27 ` [Bug c++/27211] " pinskia at gcc dot gnu dot org
@ 2006-05-26 15:30 ` bangerth at dealii dot org
  2006-07-19 11:04 ` reichelt at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2006-05-26 15:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from bangerth at dealii dot org  2006-05-26 15:29 -------
Confirmed, but low priority. One should just follow the first error message.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-05-26 15:29:49
               date|                            |


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


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

* [Bug c++/27211] Bogus error "template definition of non-template" when there is no non-template
  2006-04-19  9:11 [Bug c++/27211] New: Bogus error "template definition of non-template" when there is no non-template reichelt at gcc dot gnu dot org
  2006-04-22 20:27 ` [Bug c++/27211] " pinskia at gcc dot gnu dot org
  2006-05-26 15:30 ` bangerth at dealii dot org
@ 2006-07-19 11:04 ` reichelt at gcc dot gnu dot org
  2006-08-04 21:54 ` reichelt at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-07-19 11:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from reichelt at gcc dot gnu dot org  2006-07-19 11:04 -------
Because of Steve's patch for PR28304 we now get the following message
for the second testcase:

bug.cc:3: error: no 'void A::foo()' member function declared in class 'A'
bug.cc:3: error: no 'void A::foo()' member function declared in class 'A'
bug.cc:3: error: declaration of 'void A::foo()' outside of class is not
definition
bug.cc:3: error: template definition of non-template 'void A::foo()'

I.e. the bogus "candidate" part is now gone. :-)
Alas we now get a duplicate message right at the beginning. :-(
This is tracked in PR 28432.

All that remains in this PR is the bogus "template definition of non-template"
message.


-- 


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


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

* [Bug c++/27211] Bogus error "template definition of non-template" when there is no non-template
  2006-04-19  9:11 [Bug c++/27211] New: Bogus error "template definition of non-template" when there is no non-template reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-07-19 11:04 ` reichelt at gcc dot gnu dot org
@ 2006-08-04 21:54 ` reichelt at gcc dot gnu dot org
  2007-07-23 20:55 ` reichelt at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-08-04 21:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from reichelt at gcc dot gnu dot org  2006-08-04 21:54 -------
Because of the fix for PR 28432, comment #3 is obsolete.
We are back to square one, i.e. the original bug report.


-- 


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


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

* [Bug c++/27211] Bogus error "template definition of non-template" when there is no non-template
  2006-04-19  9:11 [Bug c++/27211] New: Bogus error "template definition of non-template" when there is no non-template reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-08-04 21:54 ` reichelt at gcc dot gnu dot org
@ 2007-07-23 20:55 ` reichelt at gcc dot gnu dot org
  2007-08-13 19:04 ` pcarlini at suse dot de
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2007-07-23 20:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from reichelt at gcc dot gnu dot org  2007-07-23 20:55 -------
On mainline the diagnostic for the second testcase got even worse:

bug.cc:3: error: no 'void A::foo()' member function declared in class 'A'
bug.cc:3: error: prototype for 'void A::foo()' does not match any in class 'A'
bug.cc:3: error: candidate is: void A::foo()
bug.cc:3: error: 'void A::foo()' cannot be overloaded
bug.cc:3: error: with 'void A::foo()'
bug.cc:3: error: declaration of 'void A::foo()' outside of class is not
definition
bug.cc:3: error: template definition of non-template 'void A::foo()'


-- 


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


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

* [Bug c++/27211] Bogus error "template definition of non-template" when there is no non-template
  2006-04-19  9:11 [Bug c++/27211] New: Bogus error "template definition of non-template" when there is no non-template reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-07-23 20:55 ` reichelt at gcc dot gnu dot org
@ 2007-08-13 19:04 ` pcarlini at suse dot de
  2007-08-14 22:07 ` paolo at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pcarlini at suse dot de @ 2007-08-13 19:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pcarlini at suse dot de  2007-08-13 19:04 -------
Working on it.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pcarlini at suse dot de
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/27211] Bogus error "template definition of non-template" when there is no non-template
  2006-04-19  9:11 [Bug c++/27211] New: Bogus error "template definition of non-template" when there is no non-template reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-08-13 19:04 ` pcarlini at suse dot de
@ 2007-08-14 22:07 ` paolo at gcc dot gnu dot org
  2007-08-14 22:14 ` paolo at gcc dot gnu dot org
  2007-08-14 22:16 ` pcarlini at suse dot de
  8 siblings, 0 replies; 10+ messages in thread
From: paolo at gcc dot gnu dot org @ 2007-08-14 22:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from paolo at gcc dot gnu dot org  2007-08-14 22:07 -------
Subject: Bug 27211

Author: paolo
Date: Tue Aug 14 22:07:31 2007
New Revision: 127492

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127492
Log:
/cp
2007-08-14  Paolo Carlini  <pcarlini@suse.de>

        PR c++/27211
        * decl2.c (check_classfn): Return error_mark_node in case of error;
        in that case, do not call add_method.
        * decl.c (start_decl): Deal with check_classfn returning
        error_mark_node.
        (grokfndecl): Likewise.
        * pt.c (tsubst_friend_function): Likewise.

/testsuite
2007-08-14  Paolo Carlini  <pcarlini@suse.de>

        PR c++/27211
        * g++.dg/template/error27.C: New.
        * g++.dg/template/error28.C: New.
        * g++.dg/other/pr28304.C: Adjust.
        * g++.old-deja/g++.mike/p811.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/template/error27.C
    trunk/gcc/testsuite/g++.dg/template/error28.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/decl2.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/other/pr28304.C
    trunk/gcc/testsuite/g++.old-deja/g++.mike/p811.C


-- 


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


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

* [Bug c++/27211] Bogus error "template definition of non-template" when there is no non-template
  2006-04-19  9:11 [Bug c++/27211] New: Bogus error "template definition of non-template" when there is no non-template reichelt at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-08-14 22:07 ` paolo at gcc dot gnu dot org
@ 2007-08-14 22:14 ` paolo at gcc dot gnu dot org
  2007-08-14 22:16 ` pcarlini at suse dot de
  8 siblings, 0 replies; 10+ messages in thread
From: paolo at gcc dot gnu dot org @ 2007-08-14 22:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from paolo at gcc dot gnu dot org  2007-08-14 22:14 -------
Subject: Bug 27211

Author: paolo
Date: Tue Aug 14 22:13:45 2007
New Revision: 127493

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127493
Log:
/cp
2007-08-14  Paolo Carlini  <pcarlini@suse.de>

        PR c++/27211
        * decl2.c (check_classfn): Return error_mark_node in case of error;
        in that case, do not call add_method.
        * decl.c (start_decl): Deal with check_classfn returning
        error_mark_node.
        (grokfndecl): Likewise.
        * pt.c (tsubst_friend_function): Likewise.

/testsuite
2007-08-14  Paolo Carlini  <pcarlini@suse.de>

        PR c++/27211
        * g++.dg/template/error27.C: New.
        * g++.dg/template/error28.C: New.
        * g++.dg/other/pr28304.C: Adjust.
        * g++.old-deja/g++.mike/p811.C: Likewise.

Modified:
    trunk/gcc/cp/pt.c


-- 


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


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

* [Bug c++/27211] Bogus error "template definition of non-template" when there is no non-template
  2006-04-19  9:11 [Bug c++/27211] New: Bogus error "template definition of non-template" when there is no non-template reichelt at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2007-08-14 22:14 ` paolo at gcc dot gnu dot org
@ 2007-08-14 22:16 ` pcarlini at suse dot de
  8 siblings, 0 replies; 10+ messages in thread
From: pcarlini at suse dot de @ 2007-08-14 22:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pcarlini at suse dot de  2007-08-14 22:16 -------
Fixed.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2007-08-14 22:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-19  9:11 [Bug c++/27211] New: Bogus error "template definition of non-template" when there is no non-template reichelt at gcc dot gnu dot org
2006-04-22 20:27 ` [Bug c++/27211] " pinskia at gcc dot gnu dot org
2006-05-26 15:30 ` bangerth at dealii dot org
2006-07-19 11:04 ` reichelt at gcc dot gnu dot org
2006-08-04 21:54 ` reichelt at gcc dot gnu dot org
2007-07-23 20:55 ` reichelt at gcc dot gnu dot org
2007-08-13 19:04 ` pcarlini at suse dot de
2007-08-14 22:07 ` paolo at gcc dot gnu dot org
2007-08-14 22:14 ` paolo at gcc dot gnu dot org
2007-08-14 22:16 ` pcarlini at suse dot de

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