This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/58363] New: Confusing error message for uncalled explicit destructor in expression


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;
           ^
$

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]