This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH: Fix 12226


PR 12226 was a situation where we were not issuing an error message
required by the standard.

Code like:

  + class foo {
  + private:
  +   foo(const foo &);
  + public:
  +   foo();
  + };
  + const foo &bar = foo();

is not valid because the standard requires that the copy constructor
for "foo" be accessible when the temporary is bound to the reference
-- even though G++ optimizes away the use of the copy constructor, as
permitted by the standard.  If the object being bound to the temporary
is an lvalue, then the copy constructor need not be accessible because
the reference is bound directly to the temporary.

The V3 testsuite had a series of tests that fell afoul of this
restriction; the fact that the copy constructors for "ios_base" and
"streambuf" are private implies that the tests listed below were not
valid.  I have corrected these tests.

Benjamin, I suggest that you factor these (and similar) tests by
creating a template that you instantiate with the right types; there's
a lot of unncessarily code duplication in these tests.  Also, your
name is given as:

  // 2003-03-26 B enjamin Kosnik  <bkoz@redhat.com>

at the top of these files.  Note the space.

Tested on i686-pc-linux-gnu, applied on the mainline.

2004-01-04  Mark Mitchell  <mark@codesourcery.com>

	PR c++/12226
	* call.c (CHECK_COPY_CONSTRUCTOR_P): New macro.
	(reference_binding): Set it when appropriate.
	(build_temp): New function, split out from ...
	(convert_like_real): ... here.  Honor CHECK_COPY_CONSTRUCTOR_P.
	(initialize_reference): Likewise.

2004-01-04  Mark Mitchell  <mark@codesourcery.com>

	PR c++/12226
	* g++.dg/init/copy7.c: New test.

2004-01-04  Mark Mitchell  <mark@codesourcery.com>

	PR c++/12226
	* testsuite/27_io/basic_filebuf/4.cc: Remove use of invalid copy
	constructor.
	* testsuite/27_io/basic_fstream/4.cc: Likewise.
	* testsuite/27_io/basic_ifstream/4.cc: Likewise.
	* testsuite/27_io/basic_ios/4.cc: Likewise.
	* testsuite/27_io/basic_iostream/4.cc: Likewise.
	* testsuite/27_io/basic_istream/4.cc: Likewise.
	* testsuite/27_io/basic_istingstream/4.cc: Likewise.
	* testsuite/27_io/basic_ofstream/4.cc: Likewise.
	* testsuite/27_io/basic_ostream/4.cc: Likewise.
	* testsuite/27_io/basic_ostringstream/4.cc: Likewise.
	* testsuite/27_io/basic_stringbuf/5.cc: Likewise.
	* testsuite/27_io/basic_stringstream/4.cc: Likewise.

Index: gcc/cp/call.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.447
diff -c -5 -p -r1.447 call.c
*** gcc/cp/call.c	29 Dec 2003 01:30:31 -0000	1.447
--- gcc/cp/call.c	4 Jan 2004 22:27:57 -0000
*************** struct z_candidate GTY(()) {
*** 495,504 ****
--- 495,508 ----
  
  /* In a REF_BIND or a BASE_CONV, this indicates that a temporary
     should be created to hold the result of the conversion.  */
  #define NEED_TEMPORARY_P(NODE) TREE_LANG_FLAG_4 (NODE)
  
+ /* TRUE in an IDENTITY_CONV or BASE_CONV if the copy constructor must
+    be accessible, even though it is not being used.  */
+ #define CHECK_COPY_CONSTRUCTOR_P(NODE) TREE_LANG_FLAG_5 (NODE)
+ 
  #define USER_CONV_CAND(NODE) WRAPPER_ZC (TREE_OPERAND (NODE, 1))
  #define USER_CONV_FN(NODE) (USER_CONV_CAND (NODE)->fn)
  
  bool
  null_ptr_cst_p (tree t)
*************** reference_binding (tree rto, tree rfrom,
*** 1174,1184 ****
       then this is either an identity conversion or the derived-to-base
       conversion, just as for direct binding.  */
    if (CLASS_TYPE_P (from) && compatible_p)
      {
        conv = build1 (IDENTITY_CONV, from, expr);
!       return direct_reference_binding (rto, conv);
      }
  
    /* [dcl.init.ref]
  
       Otherwise, a temporary of type "cv1 T1" is created and
--- 1178,1190 ----
       then this is either an identity conversion or the derived-to-base
       conversion, just as for direct binding.  */
    if (CLASS_TYPE_P (from) && compatible_p)
      {
        conv = build1 (IDENTITY_CONV, from, expr);
!       conv = direct_reference_binding (rto, conv);
!       CHECK_COPY_CONSTRUCTOR_P (TREE_OPERAND (conv, 0)) = 1;
!       return conv;
      }
  
    /* [dcl.init.ref]
  
       Otherwise, a temporary of type "cv1 T1" is created and
*************** enforce_access (tree basetype_path, tree
*** 3950,3959 ****
--- 3956,3993 ----
      }
  
    return true;
  }
  
+ /* Initialize a temporary of type TYPE with EXPR.  The FLAGS are a
+    bitwise or of LOOKUP_* values.  If any errors are warnings are
+    generated, set *DIAGNOSTIC_FN to "error" or "warning",
+    respectively.  If no diagnostics are generated, set *DIAGNOSTIC_FN
+    to NULL.  */
+ 
+ static tree
+ build_temp (tree expr, tree type, int flags, 
+ 	    void (**diagnostic_fn)(const char *, ...))
+ {
+   int savew, savee;
+ 
+   savew = warningcount, savee = errorcount;
+   expr = build_special_member_call (NULL_TREE, 
+ 				    complete_ctor_identifier,
+ 				    build_tree_list (NULL_TREE, expr), 
+ 				    TYPE_BINFO (type),
+ 				    flags);
+   if (warningcount > savew)
+     *diagnostic_fn = warning;
+   else if (errorcount > savee)
+     *diagnostic_fn = error;
+   else
+     *diagnostic_fn = NULL;
+   return expr;
+ }
+ 	    
+ 
  /* Perform the conversions in CONVS on the expression EXPR.  FN and
     ARGNUM are used for diagnostics.  ARGNUM is zero based, -1
     indicates the `this' argument of a method.  INNER is nonzero when
     being called to continue a conversion chain. It is negative when a
     reference binding will be applied, positive otherwise.  If
*************** enforce_access (tree basetype_path, tree
*** 3962,3974 ****
  
  static tree
  convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
  		   bool issue_conversion_warnings)
  {
-   int savew, savee;
- 
    tree totype = TREE_TYPE (convs);
  
    if (ICS_BAD_FLAG (convs)
        && TREE_CODE (convs) != USER_CONV
        && TREE_CODE (convs) != AMBIG_CONV
        && TREE_CODE (convs) != REF_BIND)
--- 3996,4007 ----
  
  static tree
  convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
  		   bool issue_conversion_warnings)
  {
    tree totype = TREE_TYPE (convs);
+   void (*diagnostic_fn)(const char *, ...);
  
    if (ICS_BAD_FLAG (convs)
        && TREE_CODE (convs) != USER_CONV
        && TREE_CODE (convs) != AMBIG_CONV
        && TREE_CODE (convs) != REF_BIND)
*************** convert_like_real (tree convs, tree expr
*** 4036,4074 ****
  
  	   If the target is a class, that means call a ctor.  */
  	if (IS_AGGR_TYPE (totype)
  	    && (inner >= 0 || !lvalue_p (expr)))
  	  {
! 	    savew = warningcount, savee = errorcount;
! 	    expr = build_special_member_call
! 	      (NULL_TREE, complete_ctor_identifier,
! 	       build_tree_list (NULL_TREE, expr), TYPE_BINFO (totype),
! 	       /* Core issue 84, now a DR, says that we don't allow UDCs
! 		  for these args (which deliberately breaks copy-init of an
! 		  auto_ptr<Base> from an auto_ptr<Derived>).  */
! 	       LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING|LOOKUP_NO_CONVERSION);
! 
! 	    /* Tell the user where this failing constructor call came from.  */
! 	    if (fn)
  	      {
! 		if (warningcount > savew)
! 		  warning
! 		    ("  initializing argument %P of `%D' from result of `%D'",
! 		     argnum, fn, convfn);
! 		else if (errorcount > savee)
! 		  error
  		    ("  initializing argument %P of `%D' from result of `%D'",
  		     argnum, fn, convfn);
! 	      }
! 	    else
! 	      {
! 		if (warningcount > savew)
! 		  warning ("  initializing temporary from result of `%D'",
! 			      convfn);
! 		else if (errorcount > savee)
! 		  error ("  initializing temporary from result of `%D'",
! 			    convfn);
  	      }
  	    expr = build_cplus_new (totype, expr);
  	  }
  	return expr;
        }
--- 4069,4096 ----
  
  	   If the target is a class, that means call a ctor.  */
  	if (IS_AGGR_TYPE (totype)
  	    && (inner >= 0 || !lvalue_p (expr)))
  	  {
! 	    expr = (build_temp 
! 		    (expr, totype, 
! 		     /* Core issue 84, now a DR, says that we don't
! 			allow UDCs for these args (which deliberately
! 			breaks copy-init of an auto_ptr<Base> from an
! 			auto_ptr<Derived>).  */
! 		     LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING|LOOKUP_NO_CONVERSION,
! 		     &diagnostic_fn));
! 		    
! 	    if (diagnostic_fn)
  	      {
! 		if (fn)
! 		  diagnostic_fn 
  		    ("  initializing argument %P of `%D' from result of `%D'",
  		     argnum, fn, convfn);
! 		else
! 		 diagnostic_fn 
! 		   ("  initializing temporary from result of `%D'",  convfn);
  	      }
  	    expr = build_cplus_new (totype, expr);
  	  }
  	return expr;
        }
*************** convert_like_real (tree convs, tree expr
*** 4079,4089 ****
  	 are about to bind it to a reference, in which case we need to
  	 leave it as an lvalue.  */
        if (inner >= 0
  	  && TREE_CODE (TREE_TYPE (expr)) != ARRAY_TYPE)
  	expr = decl_constant_value (expr);
!       return expr;
      case AMBIG_CONV:
        /* Call build_user_type_conversion again for the error.  */
        return build_user_type_conversion
  	(totype, TREE_OPERAND (convs, 0), LOOKUP_NORMAL);
  
--- 4101,4117 ----
  	 are about to bind it to a reference, in which case we need to
  	 leave it as an lvalue.  */
        if (inner >= 0
  	  && TREE_CODE (TREE_TYPE (expr)) != ARRAY_TYPE)
  	expr = decl_constant_value (expr);
!       if (CHECK_COPY_CONSTRUCTOR_P (convs))
! 	/* Generate a temporary copy purely to generate the required
! 	   diagnostics.  */
! 	build_temp (build_dummy_object (totype), totype, 
! 		    LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING,
! 		    &diagnostic_fn);
! 	return expr;
      case AMBIG_CONV:
        /* Call build_user_type_conversion again for the error.  */
        return build_user_type_conversion
  	(totype, TREE_OPERAND (convs, 0), LOOKUP_NORMAL);
  
*************** convert_like_real (tree convs, tree expr
*** 4106,4139 ****
      case BASE_CONV:
        if (TREE_CODE (convs) == BASE_CONV && !NEED_TEMPORARY_P (convs))
  	{
  	  /* We are going to bind a reference directly to a base-class
  	     subobject of EXPR.  */
! 	  tree base_ptr = build_pointer_type (totype);
! 
  	  /* Build an expression for `*((base*) &expr)'.  */
  	  expr = build_unary_op (ADDR_EXPR, expr, 0);
! 	  expr = perform_implicit_conversion (base_ptr, expr);
  	  expr = build_indirect_ref (expr, "implicit conversion");
  	  return expr;
  	}
  
        /* Copy-initialization where the cv-unqualified version of the source
  	 type is the same class as, or a derived class of, the class of the
  	 destination [is treated as direct-initialization].  [dcl.init] */
!       savew = warningcount, savee = errorcount;
!       expr = build_special_member_call (NULL_TREE, complete_ctor_identifier,
! 					build_tree_list (NULL_TREE, expr),
! 					TYPE_BINFO (totype),
! 					LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING);
!       if (fn)
! 	{
! 	  if (warningcount > savew)
! 	    warning ("  initializing argument %P of `%D'", argnum, fn);
! 	  else if (errorcount > savee)
! 	    error ("  initializing argument %P of `%D'", argnum, fn);
! 	}
        return build_cplus_new (totype, expr);
  
      case REF_BIND:
        {
  	tree ref_type = totype;
--- 4134,4165 ----
      case BASE_CONV:
        if (TREE_CODE (convs) == BASE_CONV && !NEED_TEMPORARY_P (convs))
  	{
  	  /* We are going to bind a reference directly to a base-class
  	     subobject of EXPR.  */
! 	  if (CHECK_COPY_CONSTRUCTOR_P (convs))
! 	    /* Generate a temporary copy purely to generate the required
! 	       diagnostics.  */
! 	    build_temp (build_dummy_object (TREE_TYPE (expr)),
! 			TREE_TYPE (expr),
! 			LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING,
! 			&diagnostic_fn);
  	  /* Build an expression for `*((base*) &expr)'.  */
  	  expr = build_unary_op (ADDR_EXPR, expr, 0);
! 	  expr = perform_implicit_conversion (build_pointer_type (totype), 
! 					      expr);
  	  expr = build_indirect_ref (expr, "implicit conversion");
  	  return expr;
  	}
  
        /* Copy-initialization where the cv-unqualified version of the source
  	 type is the same class as, or a derived class of, the class of the
  	 destination [is treated as direct-initialization].  [dcl.init] */
!       expr = build_temp (expr, totype, LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING,
! 			 &diagnostic_fn);
!       if (diagnostic_fn && fn)
! 	diagnostic_fn ("  initializing argument %P of `%D'", argnum, fn);
        return build_cplus_new (totype, expr);
  
      case REF_BIND:
        {
  	tree ref_type = totype;
*************** initialize_reference (tree type, tree ex
*** 6203,6212 ****
--- 6229,6246 ----
        conv = TREE_OPERAND (conv, 0);
        /* If the next conversion is a BASE_CONV, skip that too -- but
  	 remember that the conversion was required.  */
        if (TREE_CODE (conv) == BASE_CONV && !NEED_TEMPORARY_P (conv))
  	{
+ 	  void (*diagnostic_fn) (const char *, ...);
+ 	  if (CHECK_COPY_CONSTRUCTOR_P (conv))
+ 	    /* Generate a temporary copy purely to generate the required
+ 	       diagnostics.  */
+ 	    build_temp (build_dummy_object (TREE_TYPE (expr)),
+ 			TREE_TYPE (expr),
+ 			LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING,
+ 			&diagnostic_fn);
  	  base_conv_type = TREE_TYPE (conv);
  	  conv = TREE_OPERAND (conv, 0);
  	}
        else
  	base_conv_type = NULL_TREE;
Index: gcc/testsuite//g++.dg/init/copy7.C
===================================================================
RCS file: gcc/testsuite//g++.dg/init/copy7.C
diff -N gcc/testsuite//g++.dg/init/copy7.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- gcc/testsuite//g++.dg/init/copy7.C	4 Jan 2004 22:27:57 -0000
***************
*** 0 ****
--- 1,18 ----
+ // PR c++/12226
+ 
+ class foo {
+ private:
+   foo(const foo &);
+ public:
+   foo();
+ };
+ const foo &bar = foo();
+ 
+ class derived : public foo {
+ private:
+   derived(const derived&);
+ public:
+   derived();
+ };
+ 
+ const foo& baz = derived();
Index: libstdc++-v3/testsuite/27_io/basic_filebuf/4.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_filebuf/4.cc,v
retrieving revision 1.2
diff -c -5 -p -r1.2 4.cc
*** libstdc++-v3/testsuite/27_io/basic_filebuf/4.cc	23 Sep 2003 20:02:53 -0000	1.2
--- libstdc++-v3/testsuite/27_io/basic_filebuf/4.cc	4 Jan 2004 22:27:59 -0000
***************
*** 25,35 ****
  void test01()
  {
    // Check for required base class.
    typedef std::filebuf test_type;
    typedef std::streambuf base_type;
!   const test_type& obj = test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
--- 25,35 ----
  void test01()
  {
    // Check for required base class.
    typedef std::filebuf test_type;
    typedef std::streambuf base_type;
!   const test_type& obj = *new test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
Index: libstdc++-v3/testsuite/27_io/basic_fstream/4.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_fstream/4.cc,v
retrieving revision 1.2
diff -c -5 -p -r1.2 4.cc
*** libstdc++-v3/testsuite/27_io/basic_fstream/4.cc	23 Sep 2003 20:03:03 -0000	1.2
--- libstdc++-v3/testsuite/27_io/basic_fstream/4.cc	4 Jan 2004 22:28:00 -0000
***************
*** 26,36 ****
  void test01()
  {
    // Check for required base class.
    typedef std::fstream test_type;
    typedef std::iostream base_type;
!   const test_type& obj = test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
--- 26,36 ----
  void test01()
  {
    // Check for required base class.
    typedef std::fstream test_type;
    typedef std::iostream base_type;
!   const test_type& obj = *new test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
Index: libstdc++-v3/testsuite/27_io/basic_ifstream/4.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_ifstream/4.cc,v
retrieving revision 1.2
diff -c -5 -p -r1.2 4.cc
*** libstdc++-v3/testsuite/27_io/basic_ifstream/4.cc	23 Sep 2003 20:03:03 -0000	1.2
--- libstdc++-v3/testsuite/27_io/basic_ifstream/4.cc	4 Jan 2004 22:28:00 -0000
***************
*** 26,36 ****
  void test01()
  {
    // Check for required base class.
    typedef std::ifstream test_type;
    typedef std::istream base_type;
!   const test_type& obj = test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
--- 26,36 ----
  void test01()
  {
    // Check for required base class.
    typedef std::ifstream test_type;
    typedef std::istream base_type;
!   const test_type& obj = *new test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
Index: libstdc++-v3/testsuite/27_io/basic_ios/4.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_ios/4.cc,v
retrieving revision 1.2
diff -c -5 -p -r1.2 4.cc
*** libstdc++-v3/testsuite/27_io/basic_ios/4.cc	23 Sep 2003 20:03:04 -0000	1.2
--- libstdc++-v3/testsuite/27_io/basic_ios/4.cc	4 Jan 2004 22:28:00 -0000
*************** void test01()
*** 28,38 ****
    // Check for required base class.
    typedef std::ios test_type;
    typedef std::ios_base base_type;
    
    std::stringbuf buf;
!   const test_type& obj = test_type(&buf);
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
--- 28,38 ----
    // Check for required base class.
    typedef std::ios test_type;
    typedef std::ios_base base_type;
    
    std::stringbuf buf;
!   const test_type& obj = *new test_type(&buf);
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
Index: libstdc++-v3/testsuite/27_io/basic_iostream/4.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_iostream/4.cc,v
retrieving revision 1.2
diff -c -5 -p -r1.2 4.cc
*** libstdc++-v3/testsuite/27_io/basic_iostream/4.cc	23 Sep 2003 20:03:06 -0000	1.2
--- libstdc++-v3/testsuite/27_io/basic_iostream/4.cc	4 Jan 2004 22:28:00 -0000
*************** void test01()
*** 29,39 ****
    typedef std::iostream test_type;
    typedef std::istream base_type1;
    typedef std::ostream base_type2;
  
    std::stringbuf buf;
!   const test_type& obj = test_type(&buf);
    const base_type1* base1 __attribute__((unused)) = &obj;
    const base_type2* base2 __attribute__((unused)) = &obj;
  }
  
  int main()
--- 29,39 ----
    typedef std::iostream test_type;
    typedef std::istream base_type1;
    typedef std::ostream base_type2;
  
    std::stringbuf buf;
!   const test_type& obj = *new test_type(&buf);
    const base_type1* base1 __attribute__((unused)) = &obj;
    const base_type2* base2 __attribute__((unused)) = &obj;
  }
  
  int main()
Index: libstdc++-v3/testsuite/27_io/basic_istream/4.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_istream/4.cc,v
retrieving revision 1.2
diff -c -5 -p -r1.2 4.cc
*** libstdc++-v3/testsuite/27_io/basic_istream/4.cc	23 Sep 2003 20:03:06 -0000	1.2
--- libstdc++-v3/testsuite/27_io/basic_istream/4.cc	4 Jan 2004 22:28:00 -0000
*************** void test01()
*** 28,38 ****
    // Check for required base class.
    typedef std::istream test_type;
    typedef std::ios base_type;
    
    std::stringbuf buf;
!   const test_type& obj = test_type(&buf);
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
--- 28,38 ----
    // Check for required base class.
    typedef std::istream test_type;
    typedef std::ios base_type;
    
    std::stringbuf buf;
!   const test_type& obj = *new test_type(&buf);
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
Index: libstdc++-v3/testsuite/27_io/basic_istringstream/4.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_istringstream/4.cc,v
retrieving revision 1.2
diff -c -5 -p -r1.2 4.cc
*** libstdc++-v3/testsuite/27_io/basic_istringstream/4.cc	23 Sep 2003 20:03:10 -0000	1.2
--- libstdc++-v3/testsuite/27_io/basic_istringstream/4.cc	4 Jan 2004 22:28:00 -0000
***************
*** 26,36 ****
  void test01()
  {
    // Check for required base class.
    typedef std::istringstream test_type;
    typedef std::istream base_type;
!   const test_type& obj = test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
--- 26,36 ----
  void test01()
  {
    // Check for required base class.
    typedef std::istringstream test_type;
    typedef std::istream base_type;
!   const test_type& obj = *new test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
Index: libstdc++-v3/testsuite/27_io/basic_ofstream/4.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_ofstream/4.cc,v
retrieving revision 1.2
diff -c -5 -p -r1.2 4.cc
*** libstdc++-v3/testsuite/27_io/basic_ofstream/4.cc	23 Sep 2003 20:03:11 -0000	1.2
--- libstdc++-v3/testsuite/27_io/basic_ofstream/4.cc	4 Jan 2004 22:28:00 -0000
***************
*** 26,36 ****
  void test01()
  {
    // Check for required base class.
    typedef std::ofstream test_type;
    typedef std::ostream base_type;
!   const test_type& obj = test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
--- 26,36 ----
  void test01()
  {
    // Check for required base class.
    typedef std::ofstream test_type;
    typedef std::ostream base_type;
!   const test_type& obj = *new test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
Index: libstdc++-v3/testsuite/27_io/basic_ostream/4.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_ostream/4.cc,v
retrieving revision 1.2
diff -c -5 -p -r1.2 4.cc
*** libstdc++-v3/testsuite/27_io/basic_ostream/4.cc	23 Sep 2003 20:03:12 -0000	1.2
--- libstdc++-v3/testsuite/27_io/basic_ostream/4.cc	4 Jan 2004 22:28:00 -0000
*************** void test01()
*** 28,38 ****
    // Check for required base class.
    typedef std::ostream test_type;
    typedef std::ios base_type;
    
    std::stringbuf buf;
!   const test_type& obj = test_type(&buf);
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
--- 28,38 ----
    // Check for required base class.
    typedef std::ostream test_type;
    typedef std::ios base_type;
    
    std::stringbuf buf;
!   const test_type& obj = *new test_type(&buf);
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
Index: libstdc++-v3/testsuite/27_io/basic_ostringstream/4.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_ostringstream/4.cc,v
retrieving revision 1.2
diff -c -5 -p -r1.2 4.cc
*** libstdc++-v3/testsuite/27_io/basic_ostringstream/4.cc	23 Sep 2003 20:03:15 -0000	1.2
--- libstdc++-v3/testsuite/27_io/basic_ostringstream/4.cc	4 Jan 2004 22:28:00 -0000
***************
*** 26,36 ****
  void test01()
  {
    // Check for required base class.
    typedef std::ostringstream test_type;
    typedef std::ostream base_type;
!   const test_type& obj = test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
--- 26,36 ----
  void test01()
  {
    // Check for required base class.
    typedef std::ostringstream test_type;
    typedef std::ostream base_type;
!   const test_type& obj = *new test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
Index: libstdc++-v3/testsuite/27_io/basic_stringbuf/5.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_stringbuf/5.cc,v
retrieving revision 1.2
diff -c -5 -p -r1.2 5.cc
*** libstdc++-v3/testsuite/27_io/basic_stringbuf/5.cc	23 Sep 2003 20:03:20 -0000	1.2
--- libstdc++-v3/testsuite/27_io/basic_stringbuf/5.cc	4 Jan 2004 22:28:00 -0000
***************
*** 25,35 ****
  void test01()
  {
    // Check for required base class.
    typedef std::stringbuf test_type;
    typedef std::streambuf base_type;
!   const test_type& obj = test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
--- 25,35 ----
  void test01()
  {
    // Check for required base class.
    typedef std::stringbuf test_type;
    typedef std::streambuf base_type;
!   const test_type& obj = *new test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
Index: libstdc++-v3/testsuite/27_io/basic_stringstream/4.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/basic_stringstream/4.cc,v
retrieving revision 1.2
diff -c -5 -p -r1.2 4.cc
*** libstdc++-v3/testsuite/27_io/basic_stringstream/4.cc	23 Sep 2003 20:03:25 -0000	1.2
--- libstdc++-v3/testsuite/27_io/basic_stringstream/4.cc	4 Jan 2004 22:28:00 -0000
***************
*** 26,36 ****
  void test01()
  {
    // Check for required base class.
    typedef std::stringstream test_type;
    typedef std::iostream base_type;
!   const test_type& obj = test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {
--- 26,36 ----
  void test01()
  {
    // Check for required base class.
    typedef std::stringstream test_type;
    typedef std::iostream base_type;
!   const test_type& obj = *new test_type();
    const base_type* base __attribute__((unused)) = &obj;
  }
  
  int main()
  {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]