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

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