[LLVMbugs] [Bug 24255] New: Extraneous array-bounds errors on templated constructor

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 24 13:56:40 PDT 2015


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

            Bug ID: 24255
           Summary: Extraneous array-bounds errors on templated
                    constructor
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dnovillo at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 14644
  --> https://llvm.org/bugs/attachment.cgi?id=14644&action=edit
Test case

Given the attached code, Clang compiles it with no diagnostics (as expected),
but if I introduce an unrelated syntax error, an out-of-bounds warning is
emitted:

$ clang++ -c foo.cc -DEXTRA_ERROR
foo.cc:13:5: error: use of undeclared identifier 'undefined_variable'
    undefined_variable++;
    ^
foo.cc:6:33: warning: array index 2 is past the end of the array (which
contains 2 elements) [-Warray-bounds]
                                str[2] == '*') {}
                                ^   ~
foo.cc:16:7: note: in instantiation of function template specialization
'Foo::Foo<2>' requested here
  Foo f1("*");
      ^
foo.cc:4:7: note: array 'str' declared here
  Foo(const char(&str)[N])
      ^
1 warning and 1 error generated.


I'm expecting the warning to be emitted even without the syntax error (or not
at all).

-- 
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/20150724/4a66f7ab/attachment.html>


More information about the llvm-bugs mailing list