public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ambrus at math dot bme.hu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58363] New: Confusing error message for uncalled explicit destructor in expression
Date: Sun, 08 Sep 2013 18:08:00 -0000	[thread overview]
Message-ID: <bug-58363-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 58363
           Summary: Confusing error message for uncalled explicit
                    destructor in expression
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ambrus at math dot bme.hu

Created attachment 30766
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30766&action=edit
Preprocessed C++ source producing the bug

Dear gcc maintainers,

Gcc gives a confusing error message for the attached incorrect C++ code.  This
code uses explicit destructor call syntax but without the call parenthesis, as
in “m.~f” (where f is a type), inside an expression.  

I am using gcc 4.8.1 amd64-linux, and the command line is “g++ -v -Wall -O
destroy.ii” .  See the exact error messages below.

A correct error message might be “destroy.c:6:8: error: pseudo-destructor is
not called”.



$ cat destroy.ii
# 1 "destroy.cxx"
# 1 "<command-line>"
# 1 "destroy.cxx"
struct l {};
template<int D> void operator+(l x, int y);
typedef unsigned short f;
int main() {
 f m = 2;
 l() + m.~f;
 return 0;
}
$ g++ -v -Wall -O destroy.ii
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/gcc481/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8.1/configure --prefix=/usr/local/gcc481
-with-gmp=/usr/local -with-mpfr=/usr/local -with-mpc=/usr/local
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.8.1 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-Wall' '-O' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 /usr/local/gcc481/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/cc1plus
-fpreprocessed destroy.ii -quiet -dumpbase destroy.ii -mtune=generic
-march=x86-64 -auxbase destroy -O -Wall -version -o /tmp/cc5XA0SF.s
GNU C++ (GCC) version 4.8.1 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.8.1, GMP version 5.0.1, MPFR version 3.0.0-p3,
MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=127409
GNU C++ (GCC) version 4.8.1 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.8.1, GMP version 5.0.1, MPFR version 3.0.0-p3,
MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=127409
Compiler executable checksum: 47191b782ec6877222820ebb50c2fe12
destroy.cxx: In function ‘int main()’:
destroy.cxx:6:6: error: no match for ‘operator+’ (operand types are ‘l’ and
‘void’)
  l() + m.~f;
      ^
destroy.cxx:6:6: note: candidate is:
destroy.cxx:2:22: note: template<int D> void operator+(l, int)
 template<int D> void operator+(l x, int y);
                      ^
destroy.cxx:2:22: note:   template argument deduction/substitution failed:
destroy.cxx:6:11: note:   cannot convert ‘f.#‘var_decl’ not supported by
dump_type#<type error>::~’ (type ‘void’) to type ‘int’
  l() + m.~f;
           ^
$
>From gcc-bugs-return-429276-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Sep 08 19:26:31 2013
Return-Path: <gcc-bugs-return-429276-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 25554 invoked by alias); 8 Sep 2013 19:26:30 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 25520 invoked by uid 48); 8 Sep 2013 19:26:27 -0000
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/58358] [4.7/4.8/4.9 Regression] search_n has a Complexity violation for random access iterator
Date: Sun, 08 Sep 2013 19:26:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: minor
X-Bugzilla-Who: glisse at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-58358-4-PVOxrXFdL5@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58358-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58358-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-09/txt/msg00516.txt.bz2
Content-length: 512

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX358

--- Comment #12 from Marc Glisse <glisse at gcc dot gnu.org> ---
Chris, did you consider applying this optimized code to bidirectional iterators
and not just random access iterators? We may end up doing a few more ++/-- than
necessary, but not by more than a factor 2 I believe, and we would often save
many calls to the predicate. Something may also be doable for forward
iterators, but that's more complicated for less gain and couldn't share the
same code.


             reply	other threads:[~2013-09-08 18:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-08 18:08 ambrus at math dot bme.hu [this message]
2013-09-09 13:36 ` [Bug c++/58363] " paolo.carlini at oracle dot com
2021-08-11 21:43 ` pinskia at gcc dot gnu.org

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-58363-4@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).