[llvm-bugs] [Bug 40266] New: instantiating a non-type class template with no-linkage object as argument cause clang to crash

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 9 03:09:30 PST 2019


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

            Bug ID: 40266
           Summary: instantiating a non-type class template with
                    no-linkage object as argument cause clang to crash
           Product: clang
           Version: 2.6
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yazandaba at icloud.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 21305
  --> https://bugs.llvm.org/attachment.cgi?id=21305&action=edit
crash backtrace

struct StringObject{
  constexpr StringObject(const char*ptr){}
};

template<StringObject const&stringObject>
struct String{};

int main(){
  String<StringObject{"string"}> obj{};
}


a non-type class template with reference or pointer type must instantiate a
different class templates for each object that get passed to it as an argument
with the above code clang get crashed trying to instantiate a class template
instance with an object with no linkage

****NOTE****: clang is working fine and producing an error with
(-std=c++11,-std=c++14) and don't crash but crash when compiling the code with
(-std=++1z)

the above source code was compiled with only (-std=c++1z) compiler flag

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190109/cc9c052e/attachment.html>


More information about the llvm-bugs mailing list