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: unassignedclangb...@nondot.org
          Reporter: dnovi...@google.com
                CC: llvmbugs@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.
_______________________________________________
LLVMbugs mailing list
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to