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

            Bug ID: 40177
           Summary: c11: Accepts ill-formed program with inline function
                    definition containing modifiable variable with static
                    storage duration.
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: anders.granlun...@gmail.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

Test case (prog.c):

  inline void f()
  {
    static int x;
  }

  int main()
  {
  }

Compilation command line:

  clang prog.c -Wall -Wextra -std=c11 -pedantic-errors 

Observed behaviour:

  No error message outputed. Only a warning message outputed.

Expected behaviour:

  An error message outputed.

  The program violates 6.7.4/3:

    "An inline definition of a function with external linkage shall not contain
     a definition of a modifiable object with static or thread storage
duration,
     and shall not contain a reference to an identifier with internal linkage."

  Since  -pedantic-errors  is used we should get an error instead of a warning.

Note:

  GCC gives the expected error message.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to