public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58930] New: [C++11] Bogus error: converting to ... from initializer list would use explicit constructor
@ 2013-10-30 20:52 ppluzhnikov at google dot com
  2013-11-15  0:56 ` [Bug c++/58930] " ppluzhnikov at google dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: ppluzhnikov at google dot com @ 2013-10-30 20:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58930
           Summary: [C++11] Bogus error: converting to ... from
                    initializer list would use explicit constructor
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Google ref: b/11448857

This is somewhat similar to PR54835.

// ---
struct SampleModule
{
   explicit SampleModule (int);
};

template < typename >
struct BaseHandler
{
#ifndef BUG
   BaseHandler ();
#endif
   SampleModule module_ { 0 };
};

BaseHandler<int> a;
// ---

Clang compiles either variant.
Trunk GCC (g++ (GCC) 4.9.0 20131028 (experimental)):

g++ -c -std=c++11 t.cc && echo ok && g++ -c -std=c++11 t.cc -DBUG
ok
t.cc: In constructor 'constexpr BaseHandler<int>::BaseHandler()':
t.cc:7:8: error: converting to 'SampleModule' from initializer list would use
explicit constructor 'SampleModule::SampleModule(int)'
 struct BaseHandler
       ^
t.cc: At global scope:
t.cc:15:18: note: synthesized method 'constexpr
BaseHandler<int>::BaseHandler()' first required here
 BaseHandler<int> a;
                 ^

Making BaseHandler a non-template class also makes the problem go away.


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

end of thread, other threads:[~2014-11-19  9:19 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-30 20:52 [Bug c++/58930] New: [C++11] Bogus error: converting to ... from initializer list would use explicit constructor ppluzhnikov at google dot com
2013-11-15  0:56 ` [Bug c++/58930] " ppluzhnikov at google dot com
2013-11-15 10:34 ` redi at gcc dot gnu.org
2014-05-15 12:21 ` paolo.carlini at oracle dot com
2014-05-20 19:21 ` paolo at gcc dot gnu.org
2014-05-20 19:23 ` paolo.carlini at oracle dot com
2014-06-27  0:24 ` ppluzhnikov at google dot com
2014-06-27  9:18 ` paolo.carlini at oracle dot com
2014-07-01 18:47 ` ppluzhnikov at gcc dot gnu.org
2014-11-18 12:01 ` paolo.carlini at oracle dot com
2014-11-18 16:20 ` paolo.carlini at oracle dot com
2014-11-19  9:17 ` paolo.carlini at oracle dot com
2014-11-19  9:18 ` paolo.carlini at oracle dot com
2014-11-19  9:19 ` 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).