public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56633] New: Overload selection error for non-static data member initialization with initializer list in template class
@ 2013-03-16 13:26 st at quanttec dot com
  2013-03-16 17:45 ` [Bug c++/56633] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: st at quanttec dot com @ 2013-03-16 13:26 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56633
           Summary: Overload selection error for non-static data member
                    initialization with initializer list in template class
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: st@quanttec.com


g++ (the current SVN version) fails to compile the following valid c++11 code

#include <atomic>

struct Test1 {
    std::atomic<int> value2{0}; // no problem here
};

template <typename T> // T is not used
struct Test2 {
    std::atomic<int> value2{0}; // fails to compile
};

int main() {
    Test1 test;
    Test2<int> test2;
    return 0;
}

The following error message is generated for Test2:

g++ --std=c++11 test.cpp
test.cpp: In constructor ‘constexpr Test2<int>::Test2()’:
test.cpp:8:8: error: use of deleted function ‘std::atomic<int>::atomic(const
std::atomic<int>&)’
 struct Test2 {
        ^
In file included from test.cpp:1:0:
/opt/gcc/include/c++/4.8.0/atomic:601:7: error: declared here
       atomic(const atomic&) = delete;
       ^
test.cpp: In function ‘int main()’:
test.cpp:14:16: note: synthesized method ‘constexpr Test2<int>::Test2()’ first
required here 
     Test2<int> test2;


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

* [Bug c++/56633] Overload selection error for non-static data member initialization with initializer list in template class
  2013-03-16 13:26 [Bug c++/56633] New: Overload selection error for non-static data member initialization with initializer list in template class st at quanttec dot com
@ 2013-03-16 17:45 ` redi at gcc dot gnu.org
  2014-06-26 15:28 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2013-03-16 17:45 UTC (permalink / raw)
  To: gcc-bugs


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-03-16
                 CC|                            |jason at gcc dot gnu.org
     Ever Confirmed|0                           |1
      Known to fail|                            |4.7.3

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-03-16 17:45:07 UTC ---
Confirmed

struct A {
  A(int) { }
  A(const A&) = delete;
};

struct Test1 {
    A value2{0}; // no problem here
};

template <typename T> // T is not used
struct Test2 {
    A value2{0}; // fails to compile
};

int main() {
    Test1 test;
    Test2<int> test2;
    return 0;
}


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

* [Bug c++/56633] Overload selection error for non-static data member initialization with initializer list in template class
  2013-03-16 13:26 [Bug c++/56633] New: Overload selection error for non-static data member initialization with initializer list in template class st at quanttec dot com
  2013-03-16 17:45 ` [Bug c++/56633] " redi at gcc dot gnu.org
@ 2014-06-26 15:28 ` paolo.carlini at oracle dot com
  2014-06-26 15:36 ` paolo.carlini at oracle dot com
  2014-06-26 15:36 ` paolo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-06-26 15:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56633

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This is fixed in mainline, I'm adding the testcase and closing the bug.


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

* [Bug c++/56633] Overload selection error for non-static data member initialization with initializer list in template class
  2013-03-16 13:26 [Bug c++/56633] New: Overload selection error for non-static data member initialization with initializer list in template class st at quanttec dot com
                   ` (2 preceding siblings ...)
  2014-06-26 15:36 ` paolo.carlini at oracle dot com
@ 2014-06-26 15:36 ` paolo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-06-26 15:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56633

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Thu Jun 26 15:34:59 2014
New Revision: 212037

URL: https://gcc.gnu.org/viewcvs?rev=212037&root=gcc&view=rev
Log:
2014-06-26  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/56633
    * g++.dg/cpp0x/deleted8.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/deleted8.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/56633] Overload selection error for non-static data member initialization with initializer list in template class
  2013-03-16 13:26 [Bug c++/56633] New: Overload selection error for non-static data member initialization with initializer list in template class st at quanttec dot com
  2013-03-16 17:45 ` [Bug c++/56633] " redi at gcc dot gnu.org
  2014-06-26 15:28 ` paolo.carlini at oracle dot com
@ 2014-06-26 15:36 ` paolo.carlini at oracle dot com
  2014-06-26 15:36 ` paolo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-06-26 15:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56633

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.10.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.


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

end of thread, other threads:[~2014-06-26 15:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-16 13:26 [Bug c++/56633] New: Overload selection error for non-static data member initialization with initializer list in template class st at quanttec dot com
2013-03-16 17:45 ` [Bug c++/56633] " redi at gcc dot gnu.org
2014-06-26 15:28 ` paolo.carlini at oracle dot com
2014-06-26 15:36 ` paolo.carlini at oracle dot com
2014-06-26 15:36 ` paolo at gcc dot gnu.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).