[Bug c++/96936] New: brace initialization of const char* from string literal in specific cases doesn't compile

kirshamir at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Sep 4 12:38:37 GMT 2020


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

            Bug ID: 96936
           Summary: brace initialization of const char* from string
                    literal in specific cases doesn't compile
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kirshamir at gmail dot com
  Target Milestone: ---

template<typename T, typename U>
auto convert(U&& t) {
    // fails - see link to compiler explorer:
    return T{std::forward<U>(t)};
    // succeeds:
    // return T(std::forward<U>(t));
}

Code: https://godbolt.org/z/5q5sfb

Related to (seem to be the same issue):
https://stackoverflow.com/questions/63740618/need-for-stddecay-in-noexcept-operator


More information about the Gcc-bugs mailing list