]> granicus.if.org Git - clang/commit
Tighten checking of the "overloadable" attribute. If any function by a
authorDouglas Gregor <dgregor@apple.com>
Fri, 13 Feb 2009 00:26:38 +0000 (00:26 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 13 Feb 2009 00:26:38 +0000 (00:26 +0000)
commitae17094c001972a5949944a0a77ef6adf2a92c8f
tree528d8d092ed0dca534946b1eee43235ddadda8d6
parent5f2bfd4811996abb783aa6c7254c56baa6930e8c
Tighten checking of the "overloadable" attribute. If any function by a
given name in a given scope is marked as "overloadable", every
function declaration and definition with that same name and in that
same scope needs to have the "overloadable" attribute. Essentially,
the "overloadable" attribute is not part of attribute merging, so it
must be specified even for redeclarations. This keeps users from
trying to be too sneaky for their own good:

  double sin(double) __attribute__((overloadable)); // too sneaky
  #include <math.h>

Previously, this would have made "sin" overloadable, and therefore
given it a mangled name. Now, we get an error inside math.h when we
see a (re)declaration of "sin" that doesn't have the "overloadable"
attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64414 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/Attr.h
include/clang/Basic/DiagnosticSemaKinds.def
lib/Sema/SemaDecl.cpp
test/Sema/overloadable.c