[LLVMbugs] [Bug 16137] New: accepts invalid?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 24 07:43:56 PDT 2013


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

            Bug ID: 16137
           Summary: accepts invalid?
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rafael.espindola at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

clang will accept

void *g() {
  struct S {
  };
  extern S bax();
  return reinterpret_cast<void*>(bax);
}

Reading the standard suggests we might be pedantically correct since
[basic.link]
says

The name of a function declared in block scope .... no matching entity is
found, the block scope entity receives external linkage.

The type is not even considered. There is no way the above program could work,
so IMHO this should be a DR, but at the very least we should produce a warning.

gcc -std=c++11 says

error: ā€˜g()::S bax()ā€™, declared using local type ā€˜g()::Sā€™, is used but never
defined

-- 
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/20130524/597d6cdb/attachment.html>


More information about the llvm-bugs mailing list