summaryrefslogtreecommitdiff
path: root/test/CXX/temp/temp.spec/temp.explicit
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-05-09 03:31:27 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-05-09 03:31:27 +0000
commitfb98e7c13da639f34f34830a4e675367e0816cb6 (patch)
tree70e025e9b4a31559d1f061e72439b5414537ad3b /test/CXX/temp/temp.spec/temp.explicit
parent70cd574857c6023b8c60e325c4029a23f716c2dd (diff)
downloadclang-fb98e7c13da639f34f34830a4e675367e0816cb6.tar.gz
[c++20] Implement P0846R0: allow (ADL-only) calls to template-ids whose
template name is not visible to unqualified lookup. In order to support this without a severe degradation in our ability to diagnose typos in template names, this change significantly restructures the way we handle template-id-shaped syntax for which lookup of the template name finds nothing. Instead of eagerly diagnosing an undeclared template name, we now form a placeholder template-name representing a name that is known to not find any templates. When the parser sees such a name, it attempts to disambiguate whether we have a less-than comparison or a template-id. Any diagnostics or typo-correction for the name are delayed until its point of use. The upshot should be a small improvement of our diagostic quality overall: we now take more syntactic context into account when trying to resolve an undeclared identifier on the left hand side of a '<'. In fact, this works well enough that the backwards-compatible portion (for an undeclared identifier rather than a lookup that finds functions but no function templates) is enabled in all language modes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360308 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/temp/temp.spec/temp.explicit')
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p5.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p5.cpp b/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
index ca1f9a391e..5f0c4547cf 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p5.cpp
@@ -8,7 +8,10 @@ namespace N {
};
}
-template class Z<int>; // expected-error{{explicit instantiation of non-template class 'Z'}}
+template class Z<int>; // expected-error{{explicit instantiation of undeclared template class 'Z'}}
+
+struct Q;
+template class Q<int>; // expected-error{{explicit instantiation of non-template class 'Q'}}
// FIXME: This example from the standard is wrong; note posted to CWG reflector
// on 10/27/2009