diff options
author | David Blaikie <dblaikie@gmail.com> | 2019-04-19 23:02:30 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2019-04-19 23:02:30 +0000 |
commit | aa3bf6ce721dc9531f52b84e93b6ad182517561b (patch) | |
tree | c6c7ff8aa930a38c61dbbe866d5014eaa451c82e /clang/test/Modules/nested-template-default-arg-redecl.cpp | |
parent | a30920c31ffed9445ddc96203812fc812936c456 (diff) | |
download | bcm5719-llvm-aa3bf6ce721dc9531f52b84e93b6ad182517561b.tar.gz bcm5719-llvm-aa3bf6ce721dc9531f52b84e93b6ad182517561b.zip |
Modules: Search for a visible definition of the decl context when computing visibility of a default template parameter
The code is/was already correct for the case where a parameter is a
parameter of its enclosing lexical DeclContext (functions and classes).
But for other templates (alias and variable templates) they don't create
their own scope to be members of - in those cases, they parameter should
be considered visible if any definition of the lexical decl context is
visible.
[this should cleanup the failure on the libstdc++ modules buildbot]
[this doesn't actually fix the variable template case for a
secondary/compounding reason (its lexical decl context is incorrectly
considered to be the translation unit)]
Test covers all 4 kinds of templates with default args, including a
regression test for the still broken variable template case.
Reviewers: rsmith
Differential Revision: https://reviews.llvm.org/D60892
llvm-svn: 358795
Diffstat (limited to 'clang/test/Modules/nested-template-default-arg-redecl.cpp')
-rw-r--r-- | clang/test/Modules/nested-template-default-arg-redecl.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/Modules/nested-template-default-arg-redecl.cpp b/clang/test/Modules/nested-template-default-arg-redecl.cpp new file mode 100644 index 00000000000..3baa2022625 --- /dev/null +++ b/clang/test/Modules/nested-template-default-arg-redecl.cpp @@ -0,0 +1,18 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -x c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ +// RUN: -I %S/Inputs/nested-template-default-arg-redecl -std=c++14 \ +// RUN: -fmodules-local-submodule-visibility -verify %s +#include "alias2.h" +#include "var2.h" +#include "strct2.h" +#include "func2.h" + +// FIXME: Variable templates lexical decl context appears to be the translation +// unit, which is incorrect. Fixing this will hopefully address the following +// error/bug: + +// expected-note@Inputs/nested-template-default-arg-redecl/var.h:4 {{default argument declared here}} +auto var = &var_outer::var<>; // expected-error {{default argument of 'var' must be imported from module 'VAR1' before it is required}} +auto func = &func_outer::func<>; +strct_outer::strct<> *strct; +alias_outer::alias<> *alias; |