public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/31671]  New: Non-type template of type const ref accepted as a non-const ref
@ 2007-04-23 18:38 chgros at coverity dot com
  2007-04-23 19:15 ` [Bug c++/31671] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 5+ messages in thread
From: chgros at coverity dot com @ 2007-04-23 18:38 UTC (permalink / raw)
  To: gcc-bugs

The following code compiles in all the gcc versions I tested (4.0.1, 4.1.1,
4.1.2):

template<int &i> void doit() {
    i = 0;
}

template<const int &i> class X {
public:
    void foo() {
        doit<i>();
    }
};

int i;

X<i> x;

int main(int argc, char **argv) {
   x.foo();
}


Note that if "i" is declared const then the code will not compile.


-- 
           Summary: Non-type template of type const ref accepted as a non-
                    const ref
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: chgros at coverity dot com
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i686-linux-gnu
GCC target triplet: i686-linux-gnu


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


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

* [Bug c++/31671] Non-type template of type const ref accepted as a non-const ref
  2007-04-23 18:38 [Bug c++/31671] New: Non-type template of type const ref accepted as a non-const ref chgros at coverity dot com
@ 2007-04-23 19:15 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-23 19:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-04-23 20:14 -------
Confirmed, not a regression as far as I can tell.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|i486-linux-gnu              |
   GCC host triplet|i686-linux-gnu              |
 GCC target triplet|i686-linux-gnu              |
           Keywords|                            |accepts-invalid
      Known to fail|                            |3.3.3 4.3.0 4.2.0
   Last reconfirmed|0000-00-00 00:00:00         |2007-04-23 20:14:52
               date|                            |


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


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

* [Bug c++/31671] Non-type template of type const ref accepted as a non-const ref
       [not found] <bug-31671-4@http.gcc.gnu.org/bugzilla/>
  2013-10-10 12:06 ` paolo.carlini at oracle dot com
  2013-10-11 14:18 ` paolo at gcc dot gnu.org
@ 2013-10-11 14:19 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-11 14:19 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.9.0.


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

* [Bug c++/31671] Non-type template of type const ref accepted as a non-const ref
       [not found] <bug-31671-4@http.gcc.gnu.org/bugzilla/>
  2013-10-10 12:06 ` paolo.carlini at oracle dot com
@ 2013-10-11 14:18 ` paolo at gcc dot gnu.org
  2013-10-11 14:19 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2013-10-11 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Fri Oct 11 14:18:42 2013
New Revision: 203444

URL: http://gcc.gnu.org/viewcvs?rev=203444&root=gcc&view=rev
Log:
/cp
2013-10-11  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/31671
    * pt.c (convert_nontype_argument): Set expr_type to
    TREE_TYPE (probe_type).

/testsuite
2013-10-11  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/31671
    * g++.dg/template/nontype26.C: New.

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


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

* [Bug c++/31671] Non-type template of type const ref accepted as a non-const ref
       [not found] <bug-31671-4@http.gcc.gnu.org/bugzilla/>
@ 2013-10-10 12:06 ` paolo.carlini at oracle dot com
  2013-10-11 14:18 ` paolo at gcc dot gnu.org
  2013-10-11 14:19 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-10 12:06 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|gcc-bugs at gcc dot gnu.org        |
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
   Target Milestone|---                         |4.9.0
      Known to fail|                            |

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.


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

end of thread, other threads:[~2013-10-11 14:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-23 18:38 [Bug c++/31671] New: Non-type template of type const ref accepted as a non-const ref chgros at coverity dot com
2007-04-23 19:15 ` [Bug c++/31671] " pinskia at gcc dot gnu dot org
     [not found] <bug-31671-4@http.gcc.gnu.org/bugzilla/>
2013-10-10 12:06 ` paolo.carlini at oracle dot com
2013-10-11 14:18 ` paolo at gcc dot gnu.org
2013-10-11 14:19 ` paolo.carlini at oracle dot com

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).