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; 4+ 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] 4+ messages in thread

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

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