]> granicus.if.org Git - clang/commit
Add support for calls to dependent names within templates, e.g.,
authorDouglas Gregor <dgregor@apple.com>
Sat, 6 Dec 2008 00:22:45 +0000 (00:22 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sat, 6 Dec 2008 00:22:45 +0000 (00:22 +0000)
commit5c37de788529cd9180f22069970737a7208bd625
treee312bb0c82149423384efa721601dd32710f74b4
parent898574e7496ba8fd76290079d3a9d06954992734
Add support for calls to dependent names within templates, e.g.,

  template<typename T> void f(T x) {
    g(x); // g is a dependent name, so don't even bother to look it up
    g(); // error: g is not a dependent name
  }

Note that when we see "g(", we build a CXXDependentNameExpr. However,
if none of the call arguments are type-dependent, we will force the
resolution of the name "g" and replace the CXXDependentNameExpr with
its result.

GCC actually produces a nice error message when you make this
mistake, and even offers to compile your code with -fpermissive. I'll
do the former next, but I don't plan to do the latter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60618 91177308-0d34-0410-b5e6-96231b3b80d8
12 files changed:
Driver/PrintParserCallbacks.cpp
include/clang/AST/ExprCXX.h
include/clang/AST/StmtNodes.def
include/clang/Parse/Action.h
lib/AST/ExprCXX.cpp
lib/AST/StmtPrinter.cpp
lib/AST/StmtSerialization.cpp
lib/Parse/ParseExpr.cpp
lib/Sema/Sema.h
lib/Sema/SemaExpr.cpp
lib/Sema/SemaOverload.cpp
test/SemaCXX/type-dependent-exprs.cpp