https://bugs.llvm.org/show_bug.cgi?id=42980

            Bug ID: 42980
           Summary: Conditional explicit not respected with out-of-line
                    definition
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

Reduced from StackOverflow (https://stackoverflow.com/q/57467490/2069064):

using size_t = decltype(sizeof(0));

struct Str {
    template <size_t N>
    explicit(N > 7) Str(char const (&str)[N]);
};

#ifdef OUT_OF_LINE
template <size_t N>
Str::Str(char const(&str)[N]) { }
#endif

Str a = "short";
Str b = "not so short";

As-is, clang correctly rejects the construction of b (since that constructor is
explicit). But with -DOUT_OF_LINE, clang accepts.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to