This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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 PC 10903


We were being sloppy about use of format-specifiers.  Fixed thusly.

Bootstrapped and regtested on an i686-pc-linux-gnu.
Applied to mainline.

Thsi is something I would like to apply to gcc-3.3.2 once the branch
is unfrozen.

-- Gaby

Index: cp/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/ChangeLog,v
retrieving revision 1.3526
diff -p -r1.3526 ChangeLog
*** cp/ChangeLog	16 Jul 2003 01:41:40 -0000
--- cp/ChangeLog	16 Jul 2003 00:09:41 -0000	1.3526
***************
*** 1,9 ****
- 2003-07-16  Gabriel Dos Reis  <gdr@integrable-solutions.net>
- 
- 	PR c++/10903
- 	* pt.c (convert_nontype_argument): Fix thinko in diagnostic.
- 	Improve.
- 
  2003-07-15  Mark Mitchell  <mark@codesourcery.com>
  
  	* cp-tree.def (LOOKUP_EXPR): Remove.
--- 1,3 ----
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.728
diff -p -r1.728 pt.c
*** cp/pt.c	16 Jul 2003 01:41:45 -0000
--- cp/pt.c	16 Jul 2003 00:09:45 -0000	1.728
*************** convert_nontype_argument (tree type, tre
*** 3085,3098 ****
      }
    else 
      {
!       if (TYPE_P (expr))
!         error ("type '%T' cannot be used as a value for a non-type "
!                "template-parameter", expr);
!       else if (DECL_P (expr))
!         error ("invalid use of '%D' as a non-type template-argument", expr);
!       else
!         error ("invalid use of '%E' as a non-type template-argument", expr);
! 
        return NULL_TREE;
      }
  
--- 3085,3091 ----
      }
    else 
      {
!       error ("object `%E' cannot be used as template argument", expr);
        return NULL_TREE;
      }
  
Index: testsuite/g++.dg/template/non-type-template-argument-1.C
===================================================================
RCS file: testsuite/g++.dg/template/non-type-template-argument-1.C
diff -N testsuite/g++.dg/template/non-type-template-argument-1.C
*** testsuite/g++.dg/template/non-type-template-argument-1.C	16 Jul 2003 01:41:46 -0000
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,12 ****
- struct A { static const bool b=false; };
- 
- struct B { typedef A X; };
- 
- template <bool> struct C {};
- 
- template <typename T> struct D
- {
-    C<T::X> c;                   // { dg-error "invalid use" }
- };
- 
- D<B> d;                         // { dg-error "" }
--- 0 ----
 


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