public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58363] New: Confusing error message for uncalled explicit destructor in expression
@ 2013-09-08 18:08 ambrus at math dot bme.hu
  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
  0 siblings, 2 replies; 3+ messages in thread
From: ambrus at math dot bme.hu @ 2013-09-08 18:08 UTC (permalink / raw)
  To: gcc-bugs

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.


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

* [Bug c++/58363] Confusing error message for uncalled explicit destructor in expression
  2013-09-08 18:08 [Bug c++/58363] New: Confusing error message for uncalled explicit destructor in expression ambrus at math dot bme.hu
@ 2013-09-09 13:36 ` paolo.carlini at oracle dot com
  2021-08-11 21:43 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-09 13:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
pretty printing issue fixed for 4.9.0 in r202401:

58363.C:6:11: note:   cannot convert ‘m.~f’ (type ‘void’) to type ‘int’
>From gcc-bugs-return-429349-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Sep 09 13:39:52 2013
Return-Path: <gcc-bugs-return-429349-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 32551 invoked by alias); 9 Sep 2013 13:39:52 -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 32506 invoked by uid 55); 9 Sep 2013 13:39:50 -0000
From: "paolo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58362] Wrong column number for unused parameter
Date: Mon, 09 Sep 2013 13:39:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: paolo.carlini at oracle dot com
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-58362-4-isaOfjBtbi@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58362-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58362-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/msg00589.txt.bz2
Content-length: 684

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

--- Comment #12 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Mon Sep  9 13:39:47 2013
New Revision: 202402

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

    PR c++/58362
    * error.c (location_of): Don't handle PARM_DECLs specially.

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

    PR c++/58362
    * g++.dg/warn/Wunused-parm-5.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/warn/Wunused-parm-5.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/error.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/58363] Confusing error message for uncalled explicit destructor in expression
  2013-09-08 18:08 [Bug c++/58363] New: Confusing error message for uncalled explicit destructor in expression ambrus at math dot bme.hu
  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
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-11 21:43 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-08-11
           Severity|minor                       |enhancement
     Ever confirmed|0                           |1
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
We get now:

<source>:6:6: error: no match for 'operator+' (operand types are 'l' and
'void')
    6 |  l() + m.~f;
      |  ~~~ ^ ~
      |  |     |
      |  l     void
<source>:2:22: note: candidate: 'template<int D> void operator+(l, int)'
    2 | template<int D> void operator+(l x, int y);
      |                      ^~~~~~~~
<source>:2:22: note:   template argument deduction/substitution failed:
<source>:6:11: note:   couldn't deduce template parameter 'D'
    6 |  l() + m.~f;
      |           ^


clang gives an extra error message:
<source>:6:8: error: reference to pseudo-destructor must be called; did you
mean to call it with no arguments?
 l() + m.~f;
       ^~~~
           ()

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

end of thread, other threads:[~2021-08-11 21:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-08 18:08 [Bug c++/58363] New: Confusing error message for uncalled explicit destructor in expression ambrus at math dot bme.hu
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

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