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

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