Questions tagged [alias-declaration]

4 questions
7
votes
1 answer

Are nested parentheses allowed in function type alias declaration?

The following code can be compiled with gcc-13 and clang-16, but MSVC reports multiple errors using foo_type = void ((((int, const char*)))); // (1) // Compiler messages for line (1): // clang-16: ok. // gcc-13: ok. // MSVC-v19: error…
Igor G
  • 1,838
  • 6
  • 18
3
votes
1 answer

Is a using declaration for a non-member type equivalent to an alias declaration with an identifier equal to the terminal name of the using declarator?

In short, I'm asking if doing using foo::bar::baz; has the same effect as using baz = foo::bar::baz; (Clearly I'm assuming that foo::bar::baz names a type that is not a class member, e.g. I'm referring to something like namesapce foo::bar { using…
Enlico
  • 23,259
  • 6
  • 48
  • 102
2
votes
1 answer

Does `using` in a template class force instantiation?

This question is on how to use global variable initialization to achieve some side effect before main() is run (e.g., factory class registration before main()). This can be tricky when template is involved. Consider the following piece of…
1
vote
2 answers

can you tell me why this error appears? it concerns function pointers

main.cpp #include #include "prototipo.hpp" using namespace std; int main(){ int num_elem; int minimo; void (*compare)(int* x, int* y); compare comp; comp = swap; cout << "Inserire numero di elementi: "; cin >> num_elem; int *pointA…