[LLVMbugs] [Bug 22440] New: Segfault, multi template after non-terminated static function array w/ static function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 2 18:48:47 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22440

            Bug ID: 22440
           Summary: Segfault, multi template after non-terminated static
                    function array w/ static function
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: 8kilometers+bugzilla at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

clang crashes with segfault, the command line, preprocessed source, and run
script are attached in one file. I have all the files that caused the crash if
you need more info.
AFAICT a static array of at least 1 non-static function that is not terminated
with a semicolon and is followed by a template with 2+ arguments the second
being in another namespace causes a crash at the next delimeter
here's what I think would be most useful
1.    inc/Request.hpp:51:45: current parser token '>'
the last line here is line 51, many people enjoy cookies with their meth
    void methBad();
    void methGet();
    void methPost();
    void methOptions();
    void methTrace();
    void methHead();//hehe
    static std::function<void(Request*)> methods[] =
    {
        methBad,
        methGet,
        methPost,
        methOptions,
        methTrace,
        methHead
    }
    std::unordered_map<std::string, std::string> sendCookies;

adding a semicolon after the closing brace of methods[] or changing 'void
methX()' to 'static void methX(Request* req)' causes it to work as expected and
removes to error with the former complaining about the methods not being static
and the latter complaining about the lack of a semicolon after methods[]
inc/Request.hpp:51:39: error: non-friend class member 'string' cannot have a
qualified name
        std::unordered_map<std::string, std::string> sendCookies;
                                        ~~~~~^
however, adding a non-static method anywhere in the array (without the
semicolon) causes the crash again.
putting a vector<std::string> or non-templated variable before the map stops
the crash and removes the non-friend error as does replacing the value type of
the map with anything not in another namespace, the key type has no effect
adding a hash function 'std::unordered_map<std::string, std::string,
std::hash<std::string>> sendCookies;' still crashes at string and does not
crash if the second template argument is not in another namespace even if the
third is, and the same with a fourth arg. placing the class in namespace std
has no effect
inc/Request.hpp:52:40: error: non-friend class member 'string' cannot have a
qualified name
                std::unordered_map<std::string, std::string,
std::hash<std::string>> sendCookies;
                                                ~~~~~^
1.    inc/Request.hpp:52:46: current parser token ','

good day

-- 
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/20150203/7ad0fb56/attachment.html>


More information about the llvm-bugs mailing list