Bug 19298 - [4.0 Regression] dependent type (references) and calling a function method
Summary: [4.0 Regression] dependent type (references) and calling a function method
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P1 critical
Target Milestone: 4.0.0
Assignee: Nathan Sidwell
URL:
Keywords: diagnostic, rejects-valid
Depends on:
Blocks:
 
Reported: 2005-01-06 19:48 UTC by Ralf W. Grosse-Kunstleve
Modified: 2005-01-07 17:09 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2005-01-07 12:57:22


Attachments
Preprocessed source code (218.81 KB, application/octet-stream)
2005-01-06 19:49 UTC, Ralf W. Grosse-Kunstleve
Details
a little more reduced (163.82 KB, application/octet-stream)
2005-01-06 21:27 UTC, Andrew Pinski
Details
With removed (mostly) iostreams and some other (110.65 KB, application/octet-stream)
2005-01-06 23:47 UTC, wanderer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf W. Grosse-Kunstleve 2005-01-06 19:48:36 UTC
gcc CVS mainline, 2005/01/06 09:53 PST
Configured with: /net/legless/scratch1/rwgk/gcc_cvs_head/configure --
prefix=/usr/local_cci/gcc_cvs_head_20050106 --enable-languages=c,c++
Red Hat Enterprise Linux WS release 3 (Taroon)
Boost CVS mainline, 2005/01/06 10:09 PST

% g++ -I/net/legless/scratch1/rwgk/hot/boost -I/usr/include/python2.2 -
E /net/legless/scratch1/rwgk/hot/boost/libs/python/test/args.cpp > args_pp.cpp

% g++ -c args_pp.cpp

Lots of output ending with:

/net/legless/scratch1/rwgk/hot/boost/boost/python/object/make_ptr_instance.hpp:4
5: error: request for member ‘get_class_object’ in 
‘boost::python::converter::detail::registered_base<const volatile 
Y&>::converters’, which is of non-class type ‘const 
boost::python::converter::registration&’

The same code compiles with gcc 3.2.3 on the same machine.

I will attach the preprocessed source code. The same file is also available 
here:

http://cci.lbl.gov/~rwgk/bugs/gcc_cvs_head_20050106/args_pp.cpp.gz
Comment 1 Ralf W. Grosse-Kunstleve 2005-01-06 19:49:23 UTC
Created attachment 7886 [details]
Preprocessed source code
Comment 2 Ralf W. Grosse-Kunstleve 2005-01-06 19:51:54 UTC
Date: Thu, 06 Jan 2005 14:24:06 -0500
From: David Abrahams

Ralf W. Grosse-Kunstleve wrote:
> Hi David,
> 
> To ensure that Boost.Python will work with gcc 4 I've checked out the
> latest gcc cvs today, along with the latest boost cvs. There are lots
> of errors when compiling the Boost.Python tests, but as far as I can
> tell only two types of errors. One is an internal compiler error, i.e.
> there is no question that I have to file a bug report for this one.
> However, I am not sure about the second one. Could you please have a
> look?
> 
>   Raw error message:
>     http://cci.lbl.gov/~rwgk/bugs/gcc_cvs_head_20050106/error_which_is_of_non_
class_type
> 
>   Same but processed with gSTLFilt.pl:
>     http://cci.lbl.gov/~rwgk/bugs/gcc_cvs_head_20050106/error_which_is_of_non_
class_type_stlfilt

That's not much help, is it!?

> If you think it is a gcc 4 problem rather than a boost problem
> I'll file a bug report.

Well, let's see.  I think you can do this analysis yourself, FWIW:

/net/legless/scratch1/rwgk/hot/boost/boost/python/object/make_instance.hpp:63:
error: request for member M-CM-"M-bM-^BM-,M-KM-^\get_class_objectM-CM-"M-bM-^B
M-,M-bM-^DM-" in
M-CM-"M-bM-^BM-,M-KM-^\boost::python::converter::detail::registered_base<const v
olatile
Y&>::convertersM-CM-"M-bM-^BM-,M-bM-^DM-", which is of non-class type M-CM-"M-b
M-^BM-,M-KM-^\const
boost::python::converter::registration&M-CM-"M-bM-^BM-,M-bM-^DM-"

It seems to be claiming that the static

   registration const&

member named "converters" of

  registered_base<Y const volatile&>

Doesn't have class type.  Clearly wrong.  I mean, it's a reference to an
object of class type, but for all purposes other than initialization you
can do the same things with that as you can do with a class instance.

> Thanks!
>         Ralf
> 
> BTW: Do you know what to make of the strange characters (e.g. M-CM-"M-bM-^BM-,
M-bM-^DM-")?

GCC bug?
Comment 3 Andrew Pinski 2005-01-06 19:55:13 UTC
(In reply to comment #2)
> > BTW: Do you know what to make of the strange characters (e.g. M-CM-"M-bM-^BM-,
> M-bM-^DM-")?
> 
> GCC bug?
No,  just using UTF-8 for the quotes because your LC/LANG includes UTF-8 in there.  if you don't want 
them, don't lie to the compiler about supporting UTF-8 :).


I will try to reduce this also.
Comment 4 Andrew Pinski 2005-01-06 21:27:27 UTC
Created attachment 7887 [details]
a little more reduced

This is as far as I getting, not much but a start, someone else wants to start
reducing it?
Comment 5 wanderer 2005-01-06 23:47:25 UTC
Created attachment 7890 [details]
With removed (mostly) iostreams and some other
Comment 6 Andrew Pinski 2005-01-07 00:54:45 UTC
I decided to take a different method to reducing this testcase by using the old style copy and paste 
method which is better sometimes at reducing testcases (in fact much better and faster with C++ 
code):
struct t
{
  void f() const;
};
template <typename _Tp>
struct A
{
 static t const&  c;
};
template <typename _Tp>
void g(void)
{
  A<_Tp>::c.f();
}
void h(void)
{
  g<int>();
}
Comment 7 Andrew Pinski 2005-01-07 00:56:47 UTC
It worked with 4.0.0 20041124 so this is a new regression :(.
Comment 8 Nathan Sidwell 2005-01-07 17:09:17 UTC
2005-01-07  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/19298
	* pt.c (tsubst_qualified_id): Call convert_from_reference.
Comment 9 CVS Commits 2005-01-07 17:09:39 UTC
Subject: Bug 19298

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	nathan@gcc.gnu.org	2005-01-07 17:09:16

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

Log message:
	cp:
	PR c++/19298
	* pt.c (tsubst_qualified_id): Call convert_from_reference.
	testsuite:
	PR c++/19298
	* g++.dg/template/ref2.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4572&r2=1.4573
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.965&r2=1.966
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4865&r2=1.4866
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/ref2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1