aboutsummaryrefslogtreecommitdiff
path: root/clang/test/SemaCXX/friend-default-parameters-modules.cpp
blob: 9c4aff9f1964a7ec68bda45922b454a0194f4c11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// RUN: rm -fR %t
// RUN: split-file %s %t
// RUN: cd %t
// RUN: %clang_cc1 -std=c++20 -fmodule-map-file=modules.map -xc++ -emit-module -fmodule-name=foo modules.map -o foo.pcm
// RUN: %clang_cc1 -std=c++20 -fmodule-map-file=modules.map -O1 -emit-obj main.cc -verify -fmodule-file=foo.pcm

//--- modules.map
module "foo" {
  export *
  module "foo.h" {
    export *
    header "foo.h"
  }
}

//--- foo.h
#pragma once

template <int>
void Create(const void* = nullptr);

template <int>
struct ObjImpl {
  template <int>
  friend void ::Create(const void*);
};

template <int I>
void Create(const void*) {
  (void) ObjImpl<I>{};
}

//--- main.cc
// expected-no-diagnostics
#include "foo.h"

int main() {
  Create<42>();
}