public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pentek.imre at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/18635] use of uninitialised reference accepted in C++ front end
Date: Fri, 26 Nov 2010 17:28:00 -0000	[thread overview]
Message-ID: <bug-18635-4-p6UsW3QWgT@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-18635-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #12 from Imre Pentek <pentek.imre at gmail dot com> 2010-11-26 17:18:26 UTC ---
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > (In reply to comment #2)
> > > > int &a = a;
> > > > i don't believe this is valid code.  i believe g++ should reject the code.
> > > 
> > > I'm not convinced the compiler must reject it. EDG accepts it too.
> > 
> > Without warning? What about clang 2.8?
> 
> Yes, without warning (G++ at least warns)
> I don't know about clang

This code is as valid as unset references are valid. The standards doesn't
allow 'unset' or 'extremal' references. In this way there's no point to query
the reference from a yet-unset reference, as there's no such a state as unset
reference. If you somehow manage to query the reference from an unset reference
you actually navigated your compiler to a state which doesn't even exist. It's
like division by zero to be accepted without any (runtime/compiletime) error
messages/crashes. Briefly, I consider this code as invalid, as it generates a
state which is invalid, and has no semantic meaning, and doesn't really exist.


  parent reply	other threads:[~2010-11-26 17:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-18635-4@http.gcc.gnu.org/bugzilla/>
2010-11-26  1:05 ` adam.rak at streamnovation dot com
2010-11-26 11:23 ` redi at gcc dot gnu.org
2010-11-26 11:29 ` manu at gcc dot gnu.org
2010-11-26 12:00 ` redi at gcc dot gnu.org
2010-11-26 17:28 ` pentek.imre at gmail dot com [this message]
2010-11-26 18:40 ` redi at gcc dot gnu.org
2010-11-27 14:53 ` adam.rak at streamnovation dot com
2011-05-22 19:11 ` redi at gcc dot gnu.org
2011-06-27 11:55 ` [Bug c++/18635] [DR 504] " redi at gcc dot gnu.org
2021-04-08  0:20 ` [Bug c++/18635] [DR 504] use of uninitialised reference accepted (without -Wuninitialized) " msebor at gcc dot gnu.org
2021-04-08  8:16 ` manu at gcc dot gnu.org
2021-04-08 14:24 ` msebor at gcc dot gnu.org
2021-08-10 19:46 ` redi at gcc dot gnu.org
2024-04-12  0:06 ` mpolacek at gcc dot gnu.org
     [not found] <bug-18635-9680@http.gcc.gnu.org/bugzilla/>
2005-11-27 21:18 ` [Bug c++/18635] use of uninitialised reference accepted " gdr at gcc dot gnu dot org
2009-05-29 14:36 ` pinskia at gcc dot gnu dot org
2004-11-23 23:11 [Bug c++/18635] New: " ajo at acm dot org
2004-11-23 23:19 ` [Bug c++/18635] " pinskia at gcc dot gnu dot org
2004-11-24  2:11 ` llib at computer dot org
2004-11-24 19:07 ` pinskia at gcc dot gnu dot org
2004-11-26  2:56 ` llib at computer dot org
2004-11-26 10:17 ` giovannibajo at libero dot it
2004-11-29  0:56 ` llib at computer dot org
2004-11-29 11:26 ` giovannibajo at libero dot it
2004-11-29 11:41 ` giovannibajo at libero dot it

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-18635-4-p6UsW3QWgT@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).