llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Default argument for alias template not exported properly

Open llvmbot opened this issue 9 years ago • 7 comments

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.

llvmbot avatar Jul 14 '17 11:07 llvmbot

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
    >
  >;

}

llvmbot avatar Jul 14 '17 13:07 llvmbot

clang version 5.0.0 (trunk 307714) Target: x86_64-apple-darwin16.6.0 Thread model: posix InstalledDir: /usr/local/bin

llvmbot avatar Jul 14 '17 11:07 llvmbot

/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

llvmbot avatar Jul 14 '17 11:07 llvmbot

@llvm/issue-subscribers-clang-codegen

Author: None (llvmbot)

| | | | --- | --- | | Bugzilla Link | [33781](https://llvm.org/bz33781) | | Version | trunk | | OS | MacOS X | | Attachments | [Reproduction Module A](https://user-images.githubusercontent.com/60944935/143755970-50874e95-e101-43fa-ae1b-5cc6cd41291a.gz), [Reproduction Module B](https://user-images.githubusercontent.com/60944935/143755971-2f69ea74-22cc-4bf2-a96f-e717c36189a6.gz) | | 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.

llvmbot avatar Mar 10 '25 22:03 llvmbot

CC @ChuanqiXu9

shafik avatar Mar 11 '25 16:03 shafik

@llvm/issue-subscribers-clang-modules

Author: None (llvmbot)

| | | | --- | --- | | Bugzilla Link | [33781](https://llvm.org/bz33781) | | Version | trunk | | OS | MacOS X | | Attachments | [Reproduction Module A](https://user-images.githubusercontent.com/60944935/143755970-50874e95-e101-43fa-ae1b-5cc6cd41291a.gz), [Reproduction Module B](https://user-images.githubusercontent.com/60944935/143755971-2f69ea74-22cc-4bf2-a96f-e717c36189a6.gz) | | 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.

llvmbot avatar Mar 11 '25 17:03 llvmbot

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

bassiounix avatar Jun 25 '26 15:06 bassiounix