public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14397] New: Trules no longer compile (regression)
@ 2004-03-03  5:24 schmid at snake dot iap dot physik dot tu-darmstadt dot de
  2004-03-03  5:26 ` [Bug c++/14397] " schmid at snake dot iap dot physik dot tu-darmstadt dot de
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: schmid at snake dot iap dot physik dot tu-darmstadt dot de @ 2004-03-03  5:24 UTC (permalink / raw)
  To: gcc-bugs

The following code, t.C, taken from the file pointers/truletest.cpp from the 
book C++ Templates - The Complete Guide by David Vandevoorde and Nicolai M. 
Josuttis, does no longer compile. It worked when last tried approximately a 
week ago. gcc 3.3 accepts this code without a problem. 
 
I appologize if this is a bogus bug report. 
 
source code 
t.C  
/* The following code example is taken from the book 
 * "C++ Templates - The Complete Guide" 
 * by David Vandevoorde and Nicolai M. Josuttis, Addison-Wesley, 2002 
 * 
 * (C) Copyright David Vandevoorde and Nicolai M. Josuttis 2002. 
 * Permission to copy, use, modify, sell and distribute this software 
 * is granted provided this copyright notice appears in all copies. 
 * This software is provided "as is" without express or implied 
 * warranty, and with no claim as to its suitability for any purpose. 
 */ 
#include "holder2.hpp" 
#include "trule.hpp" 
 
class Something { 
}; 
 
void read_something (Something* ) 
{ 
} 
 
Trule<Something> load_something()  
{ 
    Holder<Something> result(new Something); 
    read_something(result.get()); 
    return result; 
} 
 
int main()  
{ 
    Holder<Something> ptr(load_something()); 
    //... 
} 
 
Compiling t.C 
 
g++ -v -W -Wall t.C -save-temps 
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/specs 
Configured with: ../gcc/configure --enable-threads=posix --enable-languages=c,c
++,f77,objc --enable-__cxa_atexit --enable-libstdcxx-debug 
Thread model: posix 
gcc version 3.4.0 20040302 (prerelease) 
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -E -quiet -v 
-D_GNU_SOURCE t.C -mtune=pentiumpro -W -Wall -o t.ii 
ignoring nonexistent directory "NONE/include" 
ignoring nonexistent directory "/usr/local/lib/gcc/
i686-pc-linux-gnu/3.4.0/../../../../i686-pc-linux-gnu/include" 
#include "..." search starts here: 
#include <...> search starts here: 
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0 
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/
i686-pc-linux-gnu 
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/
backward 
 /usr/local/include 
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/include 
 /usr/include 
End of search list. 
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -fpreprocessed t.ii 
-quiet -dumpbase t.C -mtune=pentiumpro -auxbase t -W -Wall -version -o t.s 
GNU C++ version 3.4.0 20040302 (prerelease) (i686-pc-linux-gnu) 
	compiled by GNU C version 3.4.0 20040302 (prerelease). 
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64274 
trule.hpp: In function `Trule<Something> load_something()': 
trule.hpp:42: error: `Trule<T>::Trule(Trule<T>&) [with T = Something]' is 
private 
t.C:25: error: within this context 
t.C:25: error:   initializing temporary from result of 
`Trule<T>::Trule(Holder<T>&) [with T = Something]' 
trule.hpp: In function `int main()': 
trule.hpp:42: error: `Trule<T>::Trule(Trule<T>&) [with T = Something]' is 
private 
t.C:30: error: within this context 
 
Compilation exited abnormally with code 1 at Tue Mar  2 21:45:22

-- 
           Summary: Trules no longer compile (regression)
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P1
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schmid at snake dot iap dot physik dot tu-darmstadt dot
                    de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/14397] Trules no longer compile (regression)
  2004-03-03  5:24 [Bug c++/14397] New: Trules no longer compile (regression) schmid at snake dot iap dot physik dot tu-darmstadt dot de
@ 2004-03-03  5:26 ` schmid at snake dot iap dot physik dot tu-darmstadt dot de
  2004-03-03  5:41 ` [Bug c++/14397] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: schmid at snake dot iap dot physik dot tu-darmstadt dot de @ 2004-03-03  5:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From schmid at snake dot iap dot physik dot tu-darmstadt dot de  2004-03-03 05:26 -------
Created an attachment (id=5850)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5850&action=view)
Preprocessed source file t.ii


-- 


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


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

* [Bug c++/14397] [3.4/3.5 Regression] Trules no longer compile (regression)
  2004-03-03  5:24 [Bug c++/14397] New: Trules no longer compile (regression) schmid at snake dot iap dot physik dot tu-darmstadt dot de
  2004-03-03  5:26 ` [Bug c++/14397] " schmid at snake dot iap dot physik dot tu-darmstadt dot de
@ 2004-03-03  5:41 ` pinskia at gcc dot gnu dot org
  2004-03-04 14:05 ` bangerth at dealii dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-03  5:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-03 05:41 -------
Here is a simpler form of the bug (if it is, I do not know if it is a bug at all and cannot comment on this 
one):
class Holder;
class Trule {
  public:
   Trule (Holder &);
    Trule(Trule const&);
  private:
    Trule(Trule&);
    Trule& operator= (Trule&);
};
class Holder{};
Trule load_something()
{
    Holder result;
    return result;
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Trules no longer compile    |[3.4/3.5 Regression] Trules
                   |(regression)                |no longer compile
                   |                            |(regression)
   Target Milestone|---                         |3.4.0


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


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

* [Bug c++/14397] [3.4/3.5 Regression] Trules no longer compile (regression)
  2004-03-03  5:24 [Bug c++/14397] New: Trules no longer compile (regression) schmid at snake dot iap dot physik dot tu-darmstadt dot de
  2004-03-03  5:26 ` [Bug c++/14397] " schmid at snake dot iap dot physik dot tu-darmstadt dot de
  2004-03-03  5:41 ` [Bug c++/14397] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-03-04 14:05 ` bangerth at dealii dot org
  2004-03-05 14:49 ` [Bug c++/14397] [3.4/3.5 Regression] Access check for wrong copy constructor nathan at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2004-03-04 14:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-03-04 14:05 -------
Confirmed. Here is something even smaller: 
------------- 
struct S { 
    S (int); 
    S(S const&); 
  private: 
    S(S&); 
}; 
 
S foo() 
{ 
  int result = 0; 
  return result; 
} 
---------------- 
 
And we get: 
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc 
x.cc: In function `S foo()': 
x.cc:5: error: `S::S(S&)' is private 
x.cc:11: error: within this context 
x.cc:11: error:   initializing temporary from result of `S::S(int)' 
 
Note that apparently gcc calls the conversion constructor, and then wants 
to call the copy constructor to get everything into the return slot (or 
at least wants to make sure that the copy constructor is accessible). However, 
it gets it wrong and looks for the constructor with the non-const argument, 
rather than the one with the constant argument. If I remove the former, 
gcc takes the latter (which is accessible) and is happy with it. 
 
This is a regression on 3.4 and mainline w.r.t. 3.3. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |3.4.0 3.5.0
      Known to work|                            |3.3.4
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-04 14:05:21
               date|                            |


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


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

* [Bug c++/14397] [3.4/3.5 Regression] Access check for wrong copy constructor
  2004-03-03  5:24 [Bug c++/14397] New: Trules no longer compile (regression) schmid at snake dot iap dot physik dot tu-darmstadt dot de
                   ` (2 preceding siblings ...)
  2004-03-04 14:05 ` bangerth at dealii dot org
@ 2004-03-05 14:49 ` nathan at gcc dot gnu dot org
  2004-03-09 18:26 ` 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 @ 2004-03-05 14:49 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |nathan at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/14397] [3.4/3.5 Regression] Access check for wrong copy constructor
  2004-03-03  5:24 [Bug c++/14397] New: Trules no longer compile (regression) schmid at snake dot iap dot physik dot tu-darmstadt dot de
                   ` (3 preceding siblings ...)
  2004-03-05 14:49 ` [Bug c++/14397] [3.4/3.5 Regression] Access check for wrong copy constructor nathan at gcc dot gnu dot org
@ 2004-03-09 18:26 ` cvs-commit at gcc dot gnu dot org
  2004-03-09 18:44 ` cvs-commit at gcc dot gnu dot org
  2004-03-09 19:42 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-09 18:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-09 18:26 -------
Subject: Bug 14397

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	nathan@gcc.gnu.org	2004-03-09 18:26:36

Modified files:
	gcc/cp         : ChangeLog call.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/overload: ref1.C 

Log message:
	cp:
	PR c++/14397
	* call.c (convert_like_real): Build a const qualified temporary,
	when testing ctor access.
	testsuite:
	PR c++/14397
	* g++.dg/overload/ref1.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.77&r2=1.3892.2.78
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.452.2.11&r2=1.452.2.12
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.136&r2=1.3389.2.137
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/overload/ref1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug c++/14397] [3.4/3.5 Regression] Access check for wrong copy constructor
  2004-03-03  5:24 [Bug c++/14397] New: Trules no longer compile (regression) schmid at snake dot iap dot physik dot tu-darmstadt dot de
                   ` (4 preceding siblings ...)
  2004-03-09 18:26 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-09 18:44 ` cvs-commit at gcc dot gnu dot org
  2004-03-09 19:42 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-09 18:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-09 18:44 -------
Subject: Bug 14397

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	nathan@gcc.gnu.org	2004-03-09 18:44:04

Modified files:
	gcc/cp         : ChangeLog call.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/overload: ref1.C 

Log message:
	cp:
	PR c++/14397
	* call.c (convert_like_real): Build a const qualified temporary,
	when testing ctor access.
	testsuite:
	PR c++/14397
	* g++.dg/overload/ref1.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3992&r2=1.3993
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.466&r2=1.467
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3587&r2=1.3588
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/overload/ref1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2



-- 


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


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

* [Bug c++/14397] [3.4/3.5 Regression] Access check for wrong copy constructor
  2004-03-03  5:24 [Bug c++/14397] New: Trules no longer compile (regression) schmid at snake dot iap dot physik dot tu-darmstadt dot de
                   ` (5 preceding siblings ...)
  2004-03-09 18:44 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-09 19:42 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-09 19:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-09 19:42 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
           Keywords|                            |rejects-valid
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2004-03-09 19:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-03  5:24 [Bug c++/14397] New: Trules no longer compile (regression) schmid at snake dot iap dot physik dot tu-darmstadt dot de
2004-03-03  5:26 ` [Bug c++/14397] " schmid at snake dot iap dot physik dot tu-darmstadt dot de
2004-03-03  5:41 ` [Bug c++/14397] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-03-04 14:05 ` bangerth at dealii dot org
2004-03-05 14:49 ` [Bug c++/14397] [3.4/3.5 Regression] Access check for wrong copy constructor nathan at gcc dot gnu dot org
2004-03-09 18:26 ` cvs-commit at gcc dot gnu dot org
2004-03-09 18:44 ` cvs-commit at gcc dot gnu dot org
2004-03-09 19:42 ` pinskia 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).