public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21165] New: bogus error on a user-defined conversion in a template
@ 2005-04-22 21:12 sebor at roguewave dot com
  2005-04-23  4:19 ` [Bug c++/21165] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: sebor at roguewave dot com @ 2005-04-22 21:12 UTC (permalink / raw)
  To: gcc-bugs

The test case below demonstrates two problems:

1) the line number in the error message points to an expression that involves
only two ints (i.e., no object of T::BI as the message claims).

2) the program is well formed and the error is a regression from previous
versions of the compiler.


$ cat t.cpp && gcc -c t.cpp
/*   1 */ struct A
/*   2 */ {
/*   3 */     A (int = 0);
/*   4 */     operator int () const;
/*   5 */ };
/*   6 */ 
/*   7 */ struct B
/*   8 */ {
/*   9 */     typedef int BI;
/*  10 */     typedef A   BA;
/*  11 */ 
/*  12 */ };
/*  13 */ 
/*  14 */ template <class, class T>
/*  15 */ struct C
/*  16 */ {
/*  17 */     typedef typename T::BA BA;
/*  18 */     typedef typename T::BI BI;
/*  19 */ 
/*  20 */     BA foo (BA ba) {
/*  21 */         const int i = BI (ba);
/*  22 */ 
/*  23 */         if (i < 0)
/*  24 */             return A ();
/*  25 */ 
/*  26 */         return A ();
/*  27 */     }
/*  28 */ };
/*  29 */ 
/*  30 */ template struct C<char, B>;
t.cpp: In member function 'typename T::BA C< <template-parameter-1-1>,
T>::foo(typename T::BA)':
t.cpp:23: error: 'typename T::BI' used where a 'int' was expected

-- 
           Summary: bogus error on a user-defined conversion in a template
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: sparc-sun-solaris2.9
  GCC host triplet: sparc-sun-solaris2.9
GCC target triplet: sparc-sun-solaris2.9


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


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

* [Bug c++/21165] [4.0/4.1 Regression] bogus error on a user-defined conversion in a template
  2005-04-22 21:12 [Bug c++/21165] New: bogus error on a user-defined conversion in a template sebor at roguewave dot com
@ 2005-04-23  4:19 ` pinskia at gcc dot gnu dot org
  2005-04-26 15:10 ` reichelt at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-23  4:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-23 04:18 -------
Confirmed, it ICEs with checking enabled:
t.cc: In member function 'typename T::BA C< <template-parameter-1-1>, T>::foo(typename T::BA)':
t.cc:23: internal compiler error: tree check: expected record_type or union_type or qual_union_type, 
have typename_type in lookup_conversions, at cp/search.c:2407
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |ice-checking, ice-on-valid-
                   |                            |code, rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2005-04-23 04:18:57
               date|                            |
            Summary|bogus error on a user-      |[4.0/4.1 Regression] bogus
                   |defined conversion in a     |error on a user-defined
                   |template                    |conversion in a template
   Target Milestone|---                         |4.0.1


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


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

* [Bug c++/21165] [4.0/4.1 Regression] bogus error on a user-defined conversion in a template
  2005-04-22 21:12 [Bug c++/21165] New: bogus error on a user-defined conversion in a template sebor at roguewave dot com
  2005-04-23  4:19 ` [Bug c++/21165] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-04-26 15:10 ` reichelt at gcc dot gnu dot org
  2005-05-03 21:44 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-04-26 15:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-04-26 15:10 -------
Reduced testcase that ICE's with checking enabled:

===================================
template<typename T> bool foo()
{
    const int i = T();
    return i>0;
};
===================================


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
  GCC build triplet|sparc-sun-solaris2.9        |
   GCC host triplet|sparc-sun-solaris2.9        |
 GCC target triplet|sparc-sun-solaris2.9        |
           Keywords|                            |monitored


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


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

* [Bug c++/21165] [4.0/4.1 Regression] bogus error on a user-defined conversion in a template
  2005-04-22 21:12 [Bug c++/21165] New: bogus error on a user-defined conversion in a template sebor at roguewave dot com
  2005-04-23  4:19 ` [Bug c++/21165] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
  2005-04-26 15:10 ` reichelt at gcc dot gnu dot org
@ 2005-05-03 21:44 ` pinskia at gcc dot gnu dot org
  2005-05-31 13:23 ` nathan at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-03 21:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-03 21:44 -------
*** Bug 21373 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pkoning at equallogic dot
                   |                            |com


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


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

* [Bug c++/21165] [4.0/4.1 Regression] bogus error on a user-defined conversion in a template
  2005-04-22 21:12 [Bug c++/21165] New: bogus error on a user-defined conversion in a template sebor at roguewave dot com
                   ` (2 preceding siblings ...)
  2005-05-03 21:44 ` pinskia at gcc dot gnu dot org
@ 2005-05-31 13:23 ` nathan at gcc dot gnu dot org
  2005-05-31 17:46 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: nathan at gcc dot gnu dot org @ 2005-05-31 13:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nathan at gcc dot gnu dot org  2005-05-31 13:19 -------
I think this is from my binfo changes

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |nathan at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-04-23 04:18:57         |2005-05-31 13:19:56
               date|                            |


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


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

* [Bug c++/21165] [4.0/4.1 Regression] bogus error on a user-defined conversion in a template
  2005-04-22 21:12 [Bug c++/21165] New: bogus error on a user-defined conversion in a template sebor at roguewave dot com
                   ` (3 preceding siblings ...)
  2005-05-31 13:23 ` nathan at gcc dot gnu dot org
@ 2005-05-31 17:46 ` cvs-commit at gcc dot gnu dot org
  2005-05-31 18:01 ` nathan at gcc dot gnu dot org
  2005-05-31 18:05 ` cvs-commit at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-31 17:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-31 17:43 -------
Subject: Bug 21165

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	nathan@gcc.gnu.org	2005-05-31 17:43:26

Modified files:
	gcc/cp         : ChangeLog init.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: init5.C 

Log message:
	cp:
	PR c++/21165
	* init.c (integral_constant_value): Check the type of the
	initializer, not the decl.
	testsuite:
	PR c++/21165
	* g++.dg/template/init5.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4766&r2=1.4767
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&r1=1.419&r2=1.420
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5566&r2=1.5567
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/init5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/21165] [4.0/4.1 Regression] bogus error on a user-defined conversion in a template
  2005-04-22 21:12 [Bug c++/21165] New: bogus error on a user-defined conversion in a template sebor at roguewave dot com
                   ` (4 preceding siblings ...)
  2005-05-31 17:46 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-31 18:01 ` nathan at gcc dot gnu dot org
  2005-05-31 18:05 ` cvs-commit at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: nathan at gcc dot gnu dot org @ 2005-05-31 18:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nathan at gcc dot gnu dot org  2005-05-31 18:01 -------
2005-05-31  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/21165
	* init.c (integral_constant_value): Check the type of the
	initializer, not the decl.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug c++/21165] [4.0/4.1 Regression] bogus error on a user-defined conversion in a template
  2005-04-22 21:12 [Bug c++/21165] New: bogus error on a user-defined conversion in a template sebor at roguewave dot com
                   ` (5 preceding siblings ...)
  2005-05-31 18:01 ` nathan at gcc dot gnu dot org
@ 2005-05-31 18:05 ` cvs-commit at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-31 18:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-31 18:01 -------
Subject: Bug 21165

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	nathan@gcc.gnu.org	2005-05-31 18:01:02

Modified files:
	gcc/cp         : ChangeLog init.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: init5.C 

Log message:
	cp:
	PR c++/21165
	* init.c (integral_constant_value): Check the type of the
	initializer, not the decl.
	testsuite:
	PR c++/21165
	* g++.dg/template/init5.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.50&r2=1.4648.2.51
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.412.2.4&r2=1.412.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.211&r2=1.5084.2.212
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/init5.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

end of thread, other threads:[~2005-05-31 18:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-22 21:12 [Bug c++/21165] New: bogus error on a user-defined conversion in a template sebor at roguewave dot com
2005-04-23  4:19 ` [Bug c++/21165] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-04-26 15:10 ` reichelt at gcc dot gnu dot org
2005-05-03 21:44 ` pinskia at gcc dot gnu dot org
2005-05-31 13:23 ` nathan at gcc dot gnu dot org
2005-05-31 17:46 ` cvs-commit at gcc dot gnu dot org
2005-05-31 18:01 ` nathan at gcc dot gnu dot org
2005-05-31 18:05 ` cvs-commit 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).