public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54542] New: SFINAE bug: handling new expressions
@ 2012-09-10 17:27 tsoae at mail dot ru
  2012-09-10 22:42 ` [Bug c++/54542] " paolo.carlini at oracle dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: tsoae at mail dot ru @ 2012-09-10 17:27 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54542
           Summary: SFINAE bug: handling new expressions
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tsoae@mail.ru


g++ 4.8.0 20120909 (experimental) fails to compile the following well-defined
code:

    template <class T>
        void f(decltype(new T(1, 2)) *)
    {
        T(1, 2);
    }
    template <class T>
        void f(...)
    {}

    int main()
    {
        f<int>(0);
    }

COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-shared-libgcc' '-mtune=generic'
'-march=pentiumpro'

test.cpp: In substitution of ‘template<class T> void f(decltype (new T)*) [with
T = <missing>]’:
test.cpp:12:17:   required from here
test.cpp:2:14: error: new initializer expression list treated as compound
expression [-fpermissive]
         void f(decltype(new T(1, 2)) *)
              ^
test.cpp: In substitution of ‘template<class T> void f(decltype (new T)*) [with
T = int]’:
test.cpp:12:17:   required from here
test.cpp:2:14: error: new initializer expression list treated as compound
expression [-fpermissive]
test.cpp:2:38: error: new initializer expression list treated as compound
expression [-fpermissive]
         void f(decltype(new T(1, 2)) *)
                                      ^
‘
Internal compiler error: Error reporting routines re-entered.

Compiler version info:

Target: i686-pc-linux-gnu
Configured with: ../configure --prefix=../target --enable-languages=c,c++
Thread model: posix
GNU C++ (GCC) version 4.8.0 20120909 (experimental) (i686-pc-linux-gnu)
    compiled by GNU C version 4.8.0 20120909 (experimental), GMP version 5.0.2,
MPFR version 3.1.0, MPC version 0.8.2

Explanation:

When T is int, the new-expression is ill-formed and the error occurs in
immediate context, so the former f should be excluded from the set of candidate
functions due to substitution failure.


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

* [Bug c++/54542] SFINAE bug: handling new expressions
  2012-09-10 17:27 [Bug c++/54542] New: SFINAE bug: handling new expressions tsoae at mail dot ru
@ 2012-09-10 22:42 ` paolo.carlini at oracle dot com
  2012-09-11  1:05 ` paolo at gcc dot gnu.org
  2012-09-11  1:08 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-09-10 22:42 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-09-10
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com
   Target Milestone|---                         |4.8.0
     Ever Confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-09-10 22:42:31 UTC ---
On it.


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

* [Bug c++/54542] SFINAE bug: handling new expressions
  2012-09-10 17:27 [Bug c++/54542] New: SFINAE bug: handling new expressions tsoae at mail dot ru
  2012-09-10 22:42 ` [Bug c++/54542] " paolo.carlini at oracle dot com
@ 2012-09-11  1:05 ` paolo at gcc dot gnu.org
  2012-09-11  1:08 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-09-11  1:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-09-11 01:05:21 UTC ---
Author: paolo
Date: Tue Sep 11 01:05:12 2012
New Revision: 191170

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

    PR c++/54541
    PR c++/54542
    * call.c (build_cxx_call): Add tsubst_flags_t parameter, use
    require_complete_type_sfinae.
    (build_op_delete_call, build_over_call): Adjust.
    * typeck.c (build_x_compound_expr_from_vec): Add tsubst_flags_t
    parameter.
    (cp_build_function_call_vec): Adjust.
    * init.c (build_new_1): Likewise.
    * rtti.c (throw_bad_cast, throw_bad_typeid, build_dynamic_cast_1):
    Likewise.
    * optimize.c (build_delete_destructor_body): Likewise.
    * cp-tree.h: Adjust declarations.

    * call.c (convert_arg_to_ellipsis): Use require_complete_type_sfinae.

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

    PR c++/54541
    PR c++/54542
    * g++.dg/cpp0x/sfinae40.C: New.
    * g++.dg/cpp0x/sfinae41.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/sfinae40.C
    trunk/gcc/testsuite/g++.dg/cpp0x/sfinae41.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/init.c
    trunk/gcc/cp/optimize.c
    trunk/gcc/cp/rtti.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/54542] SFINAE bug: handling new expressions
  2012-09-10 17:27 [Bug c++/54542] New: SFINAE bug: handling new expressions tsoae at mail dot ru
  2012-09-10 22:42 ` [Bug c++/54542] " paolo.carlini at oracle dot com
  2012-09-11  1:05 ` paolo at gcc dot gnu.org
@ 2012-09-11  1:08 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-09-11  1:08 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-09-11 01:08:13 UTC ---
Fixed.


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

end of thread, other threads:[~2012-09-11  1:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-10 17:27 [Bug c++/54542] New: SFINAE bug: handling new expressions tsoae at mail dot ru
2012-09-10 22:42 ` [Bug c++/54542] " paolo.carlini at oracle dot com
2012-09-11  1:05 ` paolo at gcc dot gnu.org
2012-09-11  1:08 ` paolo.carlini at oracle dot com

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