public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hstong at ca dot ibm.com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/52597] New: [C++11] missing diagnostics for invalid use of non-static member function in decltype Date: Fri, 16 Mar 2012 02:45:00 -0000 [thread overview] Message-ID: <bug-52597-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52597 Bug #: 52597 Summary: [C++11] missing diagnostics for invalid use of non-static member function in decltype Classification: Unclassified Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: hstong@ca.ibm.com Host: powerpc64-unknown-linux-gnu Target: powerpc64-unknown-linux-gnu The following test case shows that GCC allows several ill-formed decltype constructs with non-static member functions. Using the last form, SFINAE can be put into play--so wrong overload resolution and partial specialization matching can be made to occur. In particular: bar0 violates N3290 subclause 5.1.1 [expr.prim.general] paragraph 12 regarding valid uses of an id-expression that denotes a non-static data member or non- static member function. The other decltype specifiers violate N3290 subclause 5.2.5 [expr.ref] paragraph 4 since the non-static member function is not used as the left-hand operand of a member function call. ### Self-contained source:$ cat illdclty.cc struct A { int zip(); decltype(zip) bar0; // invalid use of non-static member function name // [expr.prim.general] void bar1() { typedef decltype(this->A::zip) x; } // invalid use of non-static member function name // [expr.ref] void bar2() { typedef decltype(A::zip) x; } // invalid use of non-static member function name // (same as bar1), see [class.mfct.non-static] }; typedef decltype(A().zip) x; // invalid use of non-static member function name // [expr.ref] ### Compiler invocation:$ g++-4.6.0 --std=c++0x illdclty.cc -W -Wall -pedantic -c ### Compiler output: (return code 0) ### g++ -v output:$ g++-4.6.0 -v Using built-in specs. COLLECT_GCC=g++-4.6.0 COLLECT_LTO_WRAPPER=/data/gcc/libexec/gcc/powerpc64-unknown-linux-gnu/4.6.0/lto-wrapper Target: powerpc64-unknown-linux-gnu Configured with: ./configure --prefix=/data/gcc --program-suffix=-4.6.0 --disable-libssp --disable-libgcj --enable-version-specific-runtime-libs --with-cpu=default32 --enable-secureplt --with-long-double-128 --enable-shared --enable-__cxa_atexit --enable-threads=posix --enable-languages=c,c++,fortran --with-gmp=/usr/local Thread model: posix gcc version 4.6.0 (GCC)
next reply other threads:[~2012-03-16 2:33 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-03-16 2:45 hstong at ca dot ibm.com [this message] 2012-03-16 9:55 ` [Bug c++/52597] " redi at gcc dot gnu.org 2012-03-29 1:05 ` hstong at ca dot ibm.com 2012-08-24 11:53 ` redi at gcc dot gnu.org 2012-08-24 12:43 ` hstong at ca dot ibm.com 2012-08-24 14:07 ` [Bug c++/52597] [C++11] confusing " redi at gcc dot gnu.org 2013-03-27 10:06 ` paolo.carlini at oracle dot com 2020-04-27 8:26 ` redi 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-52597-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: linkBe 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).