Default argument for alias template not exported properly
| Bugzilla Link | 33781 |
| Version | trunk |
| OS | MacOS X |
| Attachments | Reproduction Module A, Reproduction Module B |
| Reporter | LLVM Bugzilla Contributor |
Extended Description
Alias template not treated the same for export as the template it aliases, breaking default arguments.
Example explains better than words.
Summary:
// bug_testing_a:
export module bug_testing_a;
export {
template <typename...> struct X;
template <
template <typename...> typename TMP = X,
bool Bool = true
> struct B;
template <
template <typename...> typename TMP = X,
bool Bool = true
> using AliasOfB = B<TMP, Bool>;
template <
template <typename...> typename TMP,
bool Bool
> struct B {};
}
// bug_testing_b:
export module bug_testing_b;
import bug_testing_a;
export {
template <typename> struct C;
template <template <typename...> typename TMP> using D
=
C
<
AliasOfB // if this is replaced with B, no problem
<
TMP
>
>;
}
clang version 5.0.0 (trunk 307714) Target: x86_64-apple-darwin16.6.0 Thread model: posix InstalledDir: /usr/local/bin
/usr/local/bin/clang++ -stdlib=libc++ -arch x86_64 -fdiagnostics-show-template-tree -ftemplate-depth=512 -ftemplate-backtrace-limit=0 -std=c++1z -fmodules-ts -fcxx-modules -fprebuilt-module-path=/Users/asher/Projects/xcode/../•Modules -Wno-unused-command-line-argument -Xclang -fmodules-local-submodule-visibility -O0 -fasm-blocks -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -F/Users/asher/Projects/•Products/Debug -MMD -MT dependencies -I/Users/asher/Projects/xcode/../strongai/test -I/Users/asher/Projects/xcode/../strongai -I/usr/local/include --precompile /Users/asher/Projects/strongai/modules/BugTesting/bug_testing_a.cppm -o /Users/asher/Projects/xcode/../•Modules/bug_testing_a.pcm
/usr/local/bin/clang++ -stdlib=libc++ -arch x86_64 -fdiagnostics-show-template-tree -ftemplate-depth=512 -ftemplate-backtrace-limit=0 -std=c++1z -fmodules-ts -fcxx-modules -fprebuilt-module-path=/Users/asher/Projects/xcode/../•Modules -Wno-unused-command-line-argument -Xclang -fmodules-local-submodule-visibility -O0 -fasm-blocks -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -F/Users/asher/Projects/•Products/Debug -MMD -MT dependencies -I/Users/asher/Projects/xcode/../strongai/test -I/Users/asher/Projects/xcode/../strongai -I/usr/local/include --precompile /Users/asher/Projects/strongai/modules/BugTesting/bug_testing_b.cppm -o /Users/asher/Projects/xcode/../•Modules/bug_testing_b.pcm
@llvm/issue-subscribers-clang-codegen
Author: None (llvmbot)
Extended Description
Alias template not treated the same for export as the template it aliases, breaking default arguments.
Example explains better than words.
CC @ChuanqiXu9
@llvm/issue-subscribers-clang-modules
Author: None (llvmbot)
Extended Description
Alias template not treated the same for export as the template it aliases, breaking default arguments.
Example explains better than words.
This issue doesn't exist in the latest version of Clang right now. I tested that using the following command:
$ clang++ -std=c++20 -fdiagnostics-show-template-tree -ftemplate-depth=512 -ftemplate-backtrace-limit=0 -fcxx-modules -fprebuilt-module-path=. -Wno-unused-command-line-argument -Xclang -fmodules-local-submodule-visibility -O0 -fasm-blocks -MMD -MT dependencies --precompile bug_testing_a.cppm -o bug_testing_a.pcm
$ clang++ -std=c++20 -fdiagnostics-show-template-tree -ftemplate-depth=512 -ftemplate-backtrace-limit=0 -fcxx-modules -fprebuilt-module-path=. -Wno-unused-command-line-argument -Xclang -fmodules-local-submodule-visibility -O0 -fasm-blocks -MMD -MT dependencies --precompile bug_testing_b.cppm -o bug_testing_b.pcm
This issue should be closed.
CC @shafik @AaronBallman @EugeneZelenko