public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14122] New: problem with non-type tmplt parm in member template
@ 2004-02-12  0:33 gcc-bugzilla at gcc dot gnu dot org
  2004-02-12  9:38 ` [Bug c++/14122] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-02-12  0:33 UTC (permalink / raw)
  To: gcc-bugs


g++ gives an error compiling the source given below.

$ g++ -c x.cc
x.cc: In instantiation of `A<(&str)>':
x.cc:9:   instantiated from here
x.cc:6: error: could not convert template argument `&str' to `const char*'
x.cc:6: error: could not convert template argument `&str' to `const char*'
x.cc:6: error: could not convert template argument `&str' to `const char*'
$

While i don't have a language reference handy at the moment, i don't
see anything wrong with the code.  Further, gcc accepted it through
at least the beginning of January.

Oddly, the error goes away if the `const' qualifier on `str' is removed.

Environment:
System: Linux karma 2.6.1 #10 Tue Feb 10 04:31:35 EST 2004 i686 i686 i386 GNU/Linux
Architecture: i686

	<machine, os, target, libraries (multiple lines)>
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --prefix=/usr/local/gcc --enable-threads=posix --enable-long-long --enable-languages=c,c++,f77

How-To-Repeat:

Compile the following:

-----------------------------------------
extern const char str[];

template <const char* P>
struct A
{
  template <const char* R>  void foo();
};

template class A<str>;
-----------------------------------------
------- Additional Comments From snyder at fnal dot gov  2004-02-12 00:33 -------
Fix:
	<how to correct or work around the problem, if known (multiple lines)>

-- 
           Summary: problem with non-type tmplt parm in member template
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: snyder at fnal dot gov
                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=14122


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

* [Bug c++/14122] problem with non-type tmplt parm in member template
  2004-02-12  0:33 [Bug c++/14122] New: problem with non-type tmplt parm in member template gcc-bugzilla at gcc dot gnu dot org
@ 2004-02-12  9:38 ` pinskia at gcc dot gnu dot org
  2004-02-14  0:43 ` [Bug c++/14122] [3.4/3.5 Regression] " mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-12  9:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-12 09:38 -------
Confirmed on the mainline also, I am think this patch caused it (but I do not have 
anything to back it up with though except that it works on the tree-ssa which was merged 
right before this patch went in):
2004-01-26  Mark Mitchell  <mark@codesourcery.com>
        * class.c (add_method): Just check processing_template_decl to
        determine whether or not we are within a template.
        * decl2.c (maybe_retrofit_in_chrg): Likewise.
        * init.c (decl_constant_value): Check the type of the declaration,
        not TREE_READONLY.
        * name-lookup.c (maybe_push_to_top_level): Rename to ...
        (push_to_top_level): ... this.
        * name-lookup.h (maybe_push_to_top_level): Do not declare it.
        * pt.c (push_template_decl_real): Reorder condition for speed.
        (convert_template_argument): Use dependency-checking functions in
        place of uses_template_parms.
        (lookup_template_class): Avoid calling uses_template_parms more
        than once.
        (uses_template_parms): Reimplement, using dependency-checking
        functions.
        (instantiate_class_template): Use push_to_top_level, not
        maybe_push_to_top_level.
        (type_unification_real): Simplify.
        (type_dependent_expression_p): Handle OFFSET_REFs and
        TEMPLATE_DECLs.
        (any_dependent_template_arguments_p): Handle multiple levels of
        template argument.
        * semantics.c (expand_or_defer_fn): Do not check
        uses_template_parms for template instantiations.
        * typeck.c (comptypes): Avoid calling cp_type_quals.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at codesourcery dot com
           Severity|normal                      |critical
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
      Known to fail|                            |3.4.0 3.5.0
      Known to work|                            |3.3.3
   Last reconfirmed|0000-00-00 00:00:00         |2004-02-12 09:38:12
               date|                            |
   Target Milestone|---                         |3.4.0
            Version|3.4                         |3.4.0


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


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

* [Bug c++/14122] [3.4/3.5 Regression] problem with non-type tmplt parm in member template
  2004-02-12  0:33 [Bug c++/14122] New: problem with non-type tmplt parm in member template gcc-bugzilla at gcc dot gnu dot org
  2004-02-12  9:38 ` [Bug c++/14122] " pinskia at gcc dot gnu dot org
@ 2004-02-14  0:43 ` mmitchel at gcc dot gnu dot org
  2004-02-14  0:49 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-02-14  0:43 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/14122] [3.4/3.5 Regression] problem with non-type tmplt parm in member template
  2004-02-12  0:33 [Bug c++/14122] New: problem with non-type tmplt parm in member template gcc-bugzilla at gcc dot gnu dot org
  2004-02-12  9:38 ` [Bug c++/14122] " pinskia at gcc dot gnu dot org
  2004-02-14  0:43 ` [Bug c++/14122] [3.4/3.5 Regression] " mmitchel at gcc dot gnu dot org
@ 2004-02-14  0:49 ` cvs-commit at gcc dot gnu dot org
  2004-02-14  2:33 ` cvs-commit at gcc dot gnu dot org
  2004-02-14  2:35 ` mmitchel at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-14  0:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-02-14 00:49 -------
Subject: Bug 14122

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-02-14 00:49:15

Modified files:
	gcc/cp         : ChangeLog cp-tree.h decl2.c search.c typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/inherit: thunk2.C 
	gcc/testsuite/g++.dg/template: array4.C 

Log message:
	PR c++/14122
	* cp-tree.h (delete_sanity): Change prototype.
	* decl2.c (delete_sanity): Make doing_vec a bool, not an int.
	Remove dead code.  Adjust code to warn about deleting an array.
	* typekc.c (decay_conversion): Use build_address and build_nop.
	
	PR c++/14108
	* search.c (accessible_p): Do not check access in thunks.
	
	PR c++/14122
	* g++.dg/template/array4.C: New test.
	
	PR c++/14108
	* g++.dg/inherit/thunk2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3953&r2=1.3954
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.952&r2=1.953
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&r1=1.698&r2=1.699
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/search.c.diff?cvsroot=gcc&r1=1.286&r2=1.287
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.527&r2=1.528
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3496&r2=1.3497
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/thunk2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/array4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/14122] [3.4/3.5 Regression] problem with non-type tmplt parm in member template
  2004-02-12  0:33 [Bug c++/14122] New: problem with non-type tmplt parm in member template gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-02-14  0:49 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-14  2:33 ` cvs-commit at gcc dot gnu dot org
  2004-02-14  2:35 ` mmitchel at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-14  2:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-02-14 02:33 -------
Subject: Bug 14122

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-02-14 02:32:54

Modified files:
	gcc/cp         : ChangeLog cp-tree.h decl2.c search.c typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/inherit: thunk2.C 
	gcc/testsuite/g++.dg/template: array4.C 

Log message:
	PR c++/14122
	* cp-tree.h (delete_sanity): Change prototype.
	* decl2.c (delete_sanity): Make doing_vec a bool, not an int.
	Remove dead code.  Adjust code to warn about deleting an array.
	* typekc.c (decay_conversion): Use build_address and build_nop.
	
	PR c++/14108
	* search.c (accessible_p): Do not check access in thunks.
	
	PR c++/14122
	* g++.dg/template/array4.C: New test.
	
	PR c++/14108
	* g++.dg/inherit/thunk2.C: New test.

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.50&r2=1.3892.2.51
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.946.4.4&r2=1.946.4.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.695.4.2&r2=1.695.4.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/search.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.284&r2=1.284.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.519.2.7&r2=1.519.2.8
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.74&r2=1.3389.2.75
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/thunk2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/array4.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=14122


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

* [Bug c++/14122] [3.4/3.5 Regression] problem with non-type tmplt parm in member template
  2004-02-12  0:33 [Bug c++/14122] New: problem with non-type tmplt parm in member template gcc-bugzilla at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-02-14  2:33 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-14  2:35 ` mmitchel at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-02-14  2:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-02-14 02:35 -------
Fixed in GCC 3.4 and GCC 3.5.

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


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


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

end of thread, other threads:[~2004-02-14  2:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-12  0:33 [Bug c++/14122] New: problem with non-type tmplt parm in member template gcc-bugzilla at gcc dot gnu dot org
2004-02-12  9:38 ` [Bug c++/14122] " pinskia at gcc dot gnu dot org
2004-02-14  0:43 ` [Bug c++/14122] [3.4/3.5 Regression] " mmitchel at gcc dot gnu dot org
2004-02-14  0:49 ` cvs-commit at gcc dot gnu dot org
2004-02-14  2:33 ` cvs-commit at gcc dot gnu dot org
2004-02-14  2:35 ` mmitchel 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).