public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/44157]  New: GCC wrongly takes a std::initializer_list argument as non-deduced context
@ 2010-05-16 12:48 schaub-johannes at web dot de
  2010-05-17  4:09 ` [Bug c++/44157] [C++0x] " jason at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: schaub-johannes at web dot de @ 2010-05-16 12:48 UTC (permalink / raw)
  To: gcc-bugs

This is well-formed, but GCC does not like it

#include <initializer_list>

template<typename T>
void f(T) { }

int main() {
  std::initializer_list<int> a = { 0 };
  f(a);
}

main1.cpp: In function 'int main()':
main1.cpp:8:6: warning: deducing 'T' as 'std::initializer_list<int>'
main1.cpp:4:6: warning:   in call to 'void f(T) [with T =
std::initializer_list<int>]'
main1.cpp:8:6: warning:   (you can disable this with -fno-deduce-init-list)

The FCD says that if the argument is "an initializer list" and the parameter is
a "T", the parameter is a non-deduced context (14.8.2.1/1). In this code,
however, the argument is not an initializer list (if called as "f({0})", it
would be). Consequently, the warning is wrong.


-- 
           Summary: GCC wrongly takes a std::initializer_list argument as
                    non-deduced context
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schaub-johannes at web dot de
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/44157] [C++0x] GCC wrongly takes a std::initializer_list argument as non-deduced context
  2010-05-16 12:48 [Bug c++/44157] New: GCC wrongly takes a std::initializer_list argument as non-deduced context schaub-johannes at web dot de
@ 2010-05-17  4:09 ` jason at gcc dot gnu dot org
  2010-05-17 19:54 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-05-17  4:09 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-05-17 04:09:01
               date|                            |


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


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

* [Bug c++/44157] [C++0x] GCC wrongly takes a std::initializer_list argument as non-deduced context
  2010-05-16 12:48 [Bug c++/44157] New: GCC wrongly takes a std::initializer_list argument as non-deduced context schaub-johannes at web dot de
  2010-05-17  4:09 ` [Bug c++/44157] [C++0x] " jason at gcc dot gnu dot org
@ 2010-05-17 19:54 ` jason at gcc dot gnu dot org
  2010-05-19 15:50 ` jason at gcc dot gnu dot org
  2010-05-19 16:10 ` jason at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-05-17 19:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jason at gcc dot gnu dot org  2010-05-17 19:54 -------
Subject: Bug 44157

Author: jason
Date: Mon May 17 19:53:55 2010
New Revision: 159509

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159509
Log:
        PR c++/44157
        * call.c (build_over_call): Limit init-list deduction warning to
        cases where the argument is actually an init-list.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/initlist34.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/44157] [C++0x] GCC wrongly takes a std::initializer_list argument as non-deduced context
  2010-05-16 12:48 [Bug c++/44157] New: GCC wrongly takes a std::initializer_list argument as non-deduced context schaub-johannes at web dot de
  2010-05-17  4:09 ` [Bug c++/44157] [C++0x] " jason at gcc dot gnu dot org
  2010-05-17 19:54 ` jason at gcc dot gnu dot org
@ 2010-05-19 15:50 ` jason at gcc dot gnu dot org
  2010-05-19 16:10 ` jason at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-05-19 15:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jason at gcc dot gnu dot org  2010-05-19 15:49 -------
Subject: Bug 44157

Author: jason
Date: Wed May 19 15:49:12 2010
New Revision: 159578

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159578
Log:
        PR c++/44157
        * call.c (build_over_call): Limit init-list deduction warning to
        cases where the argument is actually an init-list.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/g++.dg/cpp0x/initlist34.C
Modified:
    branches/gcc-4_5-branch/gcc/cp/ChangeLog
    branches/gcc-4_5-branch/gcc/cp/call.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/44157] [C++0x] GCC wrongly takes a std::initializer_list argument as non-deduced context
  2010-05-16 12:48 [Bug c++/44157] New: GCC wrongly takes a std::initializer_list argument as non-deduced context schaub-johannes at web dot de
                   ` (2 preceding siblings ...)
  2010-05-19 15:50 ` jason at gcc dot gnu dot org
@ 2010-05-19 16:10 ` jason at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-05-19 16:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jason at gcc dot gnu dot org  2010-05-19 16:10 -------
Fixed for 4.5.1.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.1


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


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

end of thread, other threads:[~2010-05-19 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-16 12:48 [Bug c++/44157] New: GCC wrongly takes a std::initializer_list argument as non-deduced context schaub-johannes at web dot de
2010-05-17  4:09 ` [Bug c++/44157] [C++0x] " jason at gcc dot gnu dot org
2010-05-17 19:54 ` jason at gcc dot gnu dot org
2010-05-19 15:50 ` jason at gcc dot gnu dot org
2010-05-19 16:10 ` jason at gcc dot gnu dot 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).