diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-12-06 00:22:45 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-12-06 00:22:45 +0000 |
commit | 5c37de788529cd9180f22069970737a7208bd625 (patch) | |
tree | e312bb0c82149423384efa721601dd32710f74b4 /lib/AST/ExprCXX.cpp | |
parent | 898574e7496ba8fd76290079d3a9d06954992734 (diff) |
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
Diffstat (limited to 'lib/AST/ExprCXX.cpp')
-rw-r--r-- | lib/AST/ExprCXX.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index 2d517196be..b5d5b4c12f 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -112,6 +112,14 @@ Stmt::child_iterator CXXNewExpr::child_end() { Stmt::child_iterator CXXDeleteExpr::child_begin() { return &Argument; } Stmt::child_iterator CXXDeleteExpr::child_end() { return &Argument+1; } +// CXXDependentNameExpr +Stmt::child_iterator CXXDependentNameExpr::child_begin() { + return child_iterator(); +} +Stmt::child_iterator CXXDependentNameExpr::child_end() { + return child_iterator(); +} + OverloadedOperatorKind CXXOperatorCallExpr::getOperator() const { // All simple function calls (e.g. func()) are implicitly cast to pointer to // function. As a result, we try and obtain the DeclRefExpr from the |